4. Math bit helpers

This module represents collection of bit representation routines, which allow accessing integer and floating point values packed into different types.

All functions and symbols are in “math_bits” module, or publicly available via “math_boost”. Use require to get access to it.

require daslib/math_bits
require daslib/math_boost

4.1. float in int,uint

int_bits_to_float(x: int): float

bit representation of x is interpreted as a float

Arguments:
  • x : int

int_bits_to_float(x: int2): float2

bit representation of x is interpreted as a float

Arguments:
  • x : int2

int_bits_to_float(x: int3): float3

bit representation of x is interpreted as a float

Arguments:
  • x : int3

int_bits_to_float(x: int4): float4

bit representation of x is interpreted as a float

Arguments:
  • x : int4

uint_bits_to_float(x: uint): float

bit representation of x is interpreted as a float

Arguments:
  • x : uint

uint_bits_to_float(x: uint2): float2

bit representation of x is interpreted as a float2

Arguments:
  • x : uint2

uint_bits_to_float(x: uint3): float3

bit representation of x is interpreted as a float3

Arguments:
  • x : uint3

uint_bits_to_float(x: uint4): float4

bit representation of x is interpreted as a float4

Arguments:
  • x : uint4

4.2. int,uint in float

float_bits_to_int(x: float): int

bit representation of x is interpreted as a int

Arguments:
  • x : float

float_bits_to_int(x: float2): int2

bit representation of x is interpreted as a int2

Arguments:
  • x : float2

float_bits_to_int(x: float3): int3

bit representation of x is interpreted as a int3

Arguments:
  • x : float3

float_bits_to_int(x: float4): int4

bit representation of x is interpreted as a int4

Arguments:
  • x : float4

float_bits_to_uint(x: float): uint

bit representation of x is interpreted as a uint

Arguments:
  • x : float

float_bits_to_uint(x: float2): uint2

bit representation of x is interpreted as a uint2

Arguments:
  • x : float2

float_bits_to_uint(x: float3): uint3

bit representation of x is interpreted as a uint3

Arguments:
  • x : float3

float_bits_to_uint(x: float4): uint4

bit representation of x is interpreted as a uint4

Arguments:
  • x : float4

4.3. int64,uint64 in double

int64_bits_to_double(x: int64): double

bit representation of x is interpreted as a double

Arguments:
  • x : int64

uint64_bits_to_double(x: uint64): double

bit representation of x is interpreted as a double

Arguments:
  • x : uint64

double_bits_to_int64(x: double): int64

bit representation of x is interpreted as a int64

Arguments:
  • x : double

double_bits_to_uint64(x: double): uint64

bit representation of x is interpreted as a uint64

Arguments:
  • x : double

4.4. bit-cast vec4f

cast_to_vec4f(x: bool): float4

return a float4 which stores bit-cast version of x

Arguments:
  • x : bool

cast_to_vec4f(x: int64): float4

return a float4 which stores bit-cast version of x

Arguments:
  • x : int64

cast_to_int64(data: float4): int64

return an int64 which was bit-cast from x

Arguments:
  • data : float4

cast_to_int32(data: float4): int

return an int32 which was bit-cast from x

Arguments:
  • data : float4

cast_to_int16(data: float4): int16

return an int16 which was bit-cast from x

Arguments:
  • data : float4

cast_to_int8(data: float4): int8

return an int8 which was bit-cast from x

Arguments:
  • data : float4

cast_to_string(data: float4): string

return a string which pointer was bit-cast from x

Arguments:
  • data : float4

cast_to_pointer(data: float4): void?

return a pointer which was bit-cast from x

Arguments:
  • data : float4