Handbook
Glossary
>be ( x n -- byte-array )
Working with binary data
Prev:
le> ( seq -- x )
Next:
>le ( x n -- byte-array )
Vocabulary
endian
Inputs
x
an
integer
n
a non-negative integer
Outputs
byte-array
a
byte-array
Word description
Converts an integer
x
into a string of
n
bytes in big endian order. Truncation will occur if the integer is not in the range
[-2^(8n),2^(8n))
.
Definition
USING:
alien.c-types
alien.data
combinators
endian.private
;
IN:
endian
:
>be
( x n -- byte-array )
{
{
2
[
big-endian
2
f
?byte-reverse
int16_t
<ref>
]
}
{
4
[
big-endian
4
f
?byte-reverse
int32_t
<ref>
]
}
{
8
[
big-endian
8
f
?byte-reverse
int64_t
<ref>
]
}
[
>slow-be
]
}
case
;