You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bytes are only used to store and transfer data. On the other hand, numbers are more applicative. We need a sane way to convert between numbers and bytes. Let’s add a few nodes to xod/bits:
i8-to-number
u8-to-number
i16-to-number
u16-to-number (same as xod/core/word-to-number)
i32-to-number
u32-to-number
number-to-i8
number-to-u8
number-to-i16
number-to-u16
number-to-i32
number-to-u32
Here, i means signed and u is unsigned. The number denotes number of bits from the byte-data side. For example, number-to-i32 have a single number input and four byte outputs. The number is considered to be integer: a fractional part is truncated if present in the input.
To serialize numbers as is, let’s implement a couple of additional nodes:
ieee754-to-number — takes four bytes and returns a single number
Rationale
Bytes are only used to store and transfer data. On the other hand, numbers are more applicative. We need a sane way to convert between numbers and bytes. Let’s add a few nodes to
xod/bits
:i8-to-number
u8-to-number
i16-to-number
u16-to-number
(same asxod/core/word-to-number
)i32-to-number
u32-to-number
number-to-i8
number-to-u8
number-to-i16
number-to-u16
number-to-i32
number-to-u32
Here,
i
means signed andu
is unsigned. The number denotes number of bits from the byte-data side. For example,number-to-i32
have a single number input and four byte outputs. The number is considered to be integer: a fractional part is truncated if present in the input.To serialize numbers as is, let’s implement a couple of additional nodes:
ieee754-to-number
— takes four bytes and returns a single numbernumber-to-ieee754
Prerequisites
#1185, #1187
Acceptance criteria
xod/bits
xod/core/word-to-number
is deprecatedThe text was updated successfully, but these errors were encountered: