Memory layout of a data structure: Difference between revisions

(Added Kotlin)
Line 709:
<lang perl6>$signal +|= 1 +< signal_ground;</lang>
Using a native int is likelier to work on a big-endian machine in any case. Another almost-there solution is the mapping of C representational types into Perl 6 for native interfaces, but it does not yet support bit fields.
 
=={{header|Phix}}==
Phix does not support bit-fields directly. The nearest/sanest thing to do probably goes something like this (completely untested)
<lang Phix>constant CD=1, RD=2, TD=3, DTR=4, ...
atom addr = allocate(2) -- or wherever
--read
sequence bits = int_to_bits(peek2u(addr),16)
integer dtr = bits[DTR]
--write
bits[DTR] = 1
poke2(addr,bits_to_int(bits))</lang>
Alternatively you can use bit-masks, or it may be possible to enhance builtins/cffi.e to manage bit-fields, then again the above C entry does not exactly inspire confidence.
 
=={{header|PicoLisp}}==
7,793

edits