The OpenD Programming Language

ionPutR

  1. size_t ionPutR(ubyte* ptr, T value, bool sign)
  2. size_t ionPutR(ubyte* ptr, T value)
    size_t
    ionPutR
    (
    T
    )
    (
    scope ubyte* ptr
    ,
    const T value
    )
    if (
    is(T == double)
    )

Examples

ubyte[9] data;
assert(ionPutR(data.ptr + data.length, -16.0) == 9);
assert(data[0] == 0x48);
assert(data[1] == 0xC0);
assert(data[2] == 0x30);
assert(data[3] == 0x00);
assert(data[4] == 0x00);
assert(data[5] == 0x00);
assert(data[6] == 0x00);
assert(data[7] == 0x00);
assert(data[8] == 0x00);

assert(ionPutR(data.ptr + data.length, 0.0) == 1);
assert(data[$ - 1] == 0x40);

assert(ionPutR(data.ptr + data.length, -0.0) == 9);
assert(data[0] == 0x48);
assert(data[1] == 0x80);
assert(data[2] == 0x00);
assert(data[3] == 0x00);
assert(data[4] == 0x00);
assert(data[5] == 0x00);
assert(data[6] == 0x00);
assert(data[7] == 0x00);
assert(data[8] == 0x00);

Meta