handling_20unsigned_2032-bit_20values
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| handling_20unsigned_2032-bit_20values [2018/03/31 13:19] – external edit 127.0.0.1 | handling_20unsigned_2032-bit_20values [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| //by Richard Russell, October 2006//\\ \\ BBC BASIC' | //by Richard Russell, October 2006//\\ \\ BBC BASIC' | ||
| + | <code bb4w> | ||
| DEF FNuint(N%) = (N% >>> | DEF FNuint(N%) = (N% >>> | ||
| + | </ | ||
| This function is equivalent, but it is slightly slower and somewhat bigger than the previous one: | This function is equivalent, but it is slightly slower and somewhat bigger than the previous one: | ||
| + | <code bb4w> | ||
| DEF FNuint(N%) = (N% AND & | DEF FNuint(N%) = (N% AND & | ||
| + | </ | ||
| \\ The function below performs the reverse conversion, that is it takes an unsigned value (0 <= N < 2^32) and converts it to the equivalent 32-bit integer: | \\ The function below performs the reverse conversion, that is it takes an unsigned value (0 <= N < 2^32) and converts it to the equivalent 32-bit integer: | ||
| + | <code bb4w> | ||
| DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2) | DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2) | ||
| + | </ | ||
| Alternatively: | Alternatively: | ||
| + | <code bb4w> | ||
| DEF FNintu(N) IF N > & | DEF FNintu(N) IF N > & | ||
| + | </ | ||
handling_20unsigned_2032-bit_20values.1522502363.txt.gz · Last modified: 2024/01/05 00:17 (external edit)