Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
mozaic_tips_and_tricks [2020/01/12 21:16]
_ki [Store two positive Values into a single Variable] Fixed typo
mozaic_tips_and_tricks [2020/01/12 21:22] (current)
_ki [Store two positive Values into a single Variable] Updated sample code to use Div instead of RoundDown
Line 70: Line 70:
  
 <​code>​ <​code>​
-  ​maxB = 1000  // Maximum value for plus one +  ​maxA = 1000  // Maximum value for plus one 
-  valA = 723   // allowed range 0 .. ~16000 +  valA = 723   // allowed range 0 .. 999 
-  varB = 124   // allowed range 0 .. 999+  varB = 124   // allowed range 0 .. ~16000
   ​   ​
-  combinedValue = valA * maxB + valB+  combinedValue = valA + valB * maxA 
 </​code> ​ </​code> ​
  
 To later extract the values from their packed format use To later extract the values from their packed format use
 <​code>​ <​code>​
-  valA = RoundDown ​combinedValue ​/ maxB +  valA = combinedValue ​% maxA 
-  valB = combinedValue ​% maxB+  valB = Div combinedValue, maxA
 </​code>​ </​code>​
 \\  \\ 
  • mozaic_tips_and_tricks.txt
  • Last modified: 2020/01/12 21:22
  • by _ki