Skip to main content

swap4(value)

Swaps the byte order of a 32-bit integer

Availability

Device + Agent

Parameters

Name Type Description
value Integer Any numerical value

Returns

Integer

Description

This function takes an 32-bit integer and reverses the byte order: bytes 0, 1, 2 and 3 become bytes 3, 2, 1 and 0, converting it from big-endian to little-endian representation, or vice versa.

Do not confuse this function with the blob library’s blob.swap4() method, which works on a target blob object not an integer parameter.