From f365f9a38685b45f6ed9da0cd68bdce80587e2a6 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 23 Aug 2020 19:37:10 -0400
Subject: [PATCH] Fix bad shift in flexi objects

---
 indra/newview/llflexibleobject.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index e075a311c22..0ca70fac437 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -154,7 +154,6 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
 {	
 	S32 num_output_sections = 1<<dest_sections;
 	LLVector3 scale = mVO->mDrawable->getScale();
-	F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
 	F32 section_length = scale.mV[VZ] / (F32)num_output_sections;
 	if (source_sections == -1)
 	{
@@ -186,6 +185,7 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
 		// Iterate from right to left since it may be an in-place computation
 		S32 step_shift = dest_sections-source_sections;
 		S32 num_steps = 1<<step_shift;
+		F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
 		for (S32 section=num_output_sections-num_steps; section>=0; section -= num_steps)
 		{
 			LLFlexibleObjectSection *last_source_section = &source[section>>step_shift];
-- 
GitLab