Controlling byte order
The used byte order can be controlled on the module, unit, or field level.
# The 'ByteOrder' type is defined in the built-in Spicy module.
import spicy;
# Switch default from network byte order to little-endian for this module.
%byte-order=spicy::ByteOrder::Little;
# This unit uses big byte order.
type X = unit {
# Use default byte order (big).
a: uint8;
# Use little-endian byte order for this field.
b: uint8 &byte-order=spicy::ByteOrder::Little;
} &byte-order=spicy::ByteOrder::Big;