From f8d14bfe61fc7041db8ae27eb1d17b400b336c19 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 20 Jun 2021 04:08:28 -0400
Subject: [PATCH] Tired code is tired.

---
 indra/llprimitive/llmaterialid.cpp | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp
index b1127b12f3b..4c1993213f2 100644
--- a/indra/llprimitive/llmaterialid.cpp
+++ b/indra/llprimitive/llmaterialid.cpp
@@ -87,23 +87,17 @@ LLSD LLMaterialID::asLLSD() const
 
 std::string LLMaterialID::asString() const
 {
-	return fmt::format(FMT_COMPILE("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}"),
-		(U8)(mID[0]),
-		(U8)(mID[1]),
-		(U8)(mID[2]),
-		(U8)(mID[3]),
-		(U8)(mID[4]),
-		(U8)(mID[5]),
-		(U8)(mID[6]),
-		(U8)(mID[7]),
-		(U8)(mID[8]),
-		(U8)(mID[9]),
-		(U8)(mID[10]),
-		(U8)(mID[11]),
-		(U8)(mID[12]),
-		(U8)(mID[13]),
-		(U8)(mID[14]),
-		(U8)(mID[15]));
+	std::string materialIDString;
+	for (unsigned int i = 0U; i < static_cast<unsigned int>(MATERIAL_ID_SIZE / sizeof(U32)); ++i)
+	{
+		if (i != 0U)
+		{
+			materialIDString += "-";
+		}
+		const U32* value = reinterpret_cast<const U32*>(&get()[i * sizeof(U32)]);
+		materialIDString += llformat("%08x", *value);
+	}
+	return materialIDString;
 }
 
 std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id)
-- 
GitLab