17 lines
445 B
Plaintext
17 lines
445 B
Plaintext
include "NSLog.incl"
|
|
|
|
local fn IntegerToBinaryStr( x as NSInteger ) as CFStringRef
|
|
CFStringRef resultStr : resultStr = @""
|
|
|
|
while ( x )
|
|
resultStr = fn StringByAppendingString( fn StringWithFormat( @"%lu", x && 1 ), resultStr )
|
|
x = x >> 1
|
|
wend
|
|
end fn = resultStr
|
|
|
|
NSLog( @" 5 = %@", fn IntegerToBinaryStr( 5 ) )
|
|
NSLog( @" 50 = %@", fn IntegerToBinaryStr( 50 ) )
|
|
NSLog( @"9000 = %@", fn IntegerToBinaryStr( 9000 ) )
|
|
|
|
HandleEvents
|