Atom

binary.swap()

Reverses byte order within each element.

Signature

binary.swap(sequence)

Parameters

Packed scalar sequence.

Returns

New packed copy with bytes reversed per element.

Behavior

The original representation is preserved, so reading swapped bits can change the numeric value.

Errors

Compound elements, nonsequence input or invalid view.

Example

Atom
use binary
a = create(u16, 1)
a[0] = 258
assert(binary.swap(a)[0] == 513)