Three word location: Difference between revisions

→‎{{header|Wren}}: Corrected bit-masks.
m (→‎{{header|Julia}}: bit twiddles)
(→‎{{header|Wren}}: Corrected bit-masks.)
Line 525:
 
// isolate relevant bits and convert back to 'normal' ints
var w1 = ((latlon >> 28) & 0xefff0x7fff).toSmall
var w2 = ((latlon >> 14) & 0x7fff0x3fff).toSmall
var w3 = (latlon & 0x7fff0x3fff).toSmall
 
// convert to word format
Line 544:
latlon = (w1 << 28) | (w2 << 14) | w3
ilat = (latlon >> 22).toSmall
ilon = (latlon & 0xfffff0x3fffff).toSmall
lat = (ilat - 900000) / 10000
lon = (ilon - 1800000) / 10000
Line 558:
 
Three word location is:
W18497 W27708W11324 W01322
 
After reversing the procedure:
9,486

edits