Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

Binary constants

A community discussion post from the original code:zIRON forum.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Binary constants

It seems there is not yet supported.

It may be done by analogy with hex constants:

const hex_const = 0xAABBCCDD;
const bin_const = 0b11111111;

Or this way:

const bin_const = 10101010b;

And then may be also should add

const hex_const = 0AABBCCDDh;

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Added to my to-do list 0b11....

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have added 0b...., it works for numbers only at current. If you have further suggestions regarding binary usage, please let me know.

edi = 0b00000000000000000000001000000000;
print('output: ', edi, '\r\n');

output: 512

0CodErr member
Posts
201
Threads
37
Location
Unknown
it works for numbers only at current

And yet what for are you planning?

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I think it may be worth to allow binary to be used also for string constants and decimals. But I will have a fiddle with syntax to see what will work best.