Created
August 27, 2020 21:57
-
-
Save lelandrichardson/5f69f4bf4af7169a59ac0596c4f08358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Address( | |
$composer: Composer, | |
$static: Int, | |
number: Int, street: String, | |
city: String, state: String, zip: String | |
) { | |
Text($composer, ($static and 0b11) and (($static and 0b10) shr 1), "$number $street") | |
Text($composer, ($static and 0b100) shr 2, city) | |
Text($composer, 0b1, ", ") | |
Text($composer, ($static and 0b1000) shr 3, state) | |
Text($composer, 0b1, " ") | |
Text($composer, ($static and 0b10000) shr 4, zip) | |
} |
I agree @ShreckYe. I got a little confused when trying to understand too. Thanks for pointing this out! @lelandrichardson can you confirm please?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know what the compose compiler actually generates but shouldn't the first bit mask be
0b1
instead of0b11
? Though they both produce the same result,0b11
means extrating the first 2 bits whose second bit is just erased out with the secondand
, compared to which0b1
is just more straightforward. Additionally,0b1
also consists better with those bit masks afterwards such as0b10
,0b100
,0b1000
, and0b10000
.