std.intrinsic

These functions are built-in intrinsics to the compiler.

Intrinsic functions are functions built in to the compiler, usually to take advantage of specific CPU features that are inefficient to handle via external functions. The compiler's optimizer and code generator are fully integrated in with intrinsic functions, bringing to bear their full power on them. This can result in some surprising speedups.

Note that this module is only present in Tango because the module name is hardcoded into DMD, see http://d.puremagic.com/issues/show_bug.cgi?id=178 To correctly use this functionality in Tango, import tango.core.BitManip.

Members

Functions

bsf
int bsf(size_t v)

Scans the bits in v starting with bit 0, looking for the first set bit.

bsr
int bsr(size_t v)

Scans the bits in v from the most significant bit to the least significant bit, looking for the first set bit.

bswap
uint bswap(uint v)

Swaps bytes in a 4 byte uint end-to-end, i.e. byte 0 becomes byte 3, byte 1 becomes byte 2, byte 2 becomes byte 1, byte 3 becomes byte 0.

bt
int bt(size_t* p, size_t bitnum)

Tests the bit.

btc
int btc(size_t* p, size_t bitnum)

Tests and complements the bit.

btr
int btr(size_t* p, size_t bitnum)

Tests and resets (sets to 0) the bit.

bts
int bts(size_t* p, size_t bitnum)

Tests and sets the bit.

inp
ubyte inp(uint port_address)
inpl
uint inpl(uint port_address)
inpw
ushort inpw(uint port_address)

Reads I/O port at port_address.

outp
ubyte outp(uint port_address, ubyte value)
outpl
uint outpl(uint port_address, uint value)
outpw
ushort outpw(uint port_address, ushort value)

Writes and returns value to I/O port at port_address.

Meta

License

Public Domain

Authors

Walter Bright