Switch little-endian to big-endian and vice versa.

switchEndianess(x, stickyBits=FALSE)

Arguments

x

binary number. Any binary number.

stickyBits

Bits wont change if set TRUE. Only the attribute will be switched.

Value

switch little-endian to big-endian and vice versa.

See also

Examples

x <- as.binary(c(1,1,0,0), logic=TRUE); print(x); summary(x);
#> [1] 1 1 0 0
#>   Signedness  Endianess value<0 Size[bit] Base10
#> 1   unsigned Big-Endian   FALSE         4     12
y <- rdiversity:::switchEndianess(x); print(y); summary(y);
#> [1] 0 0 1 1
#>   Signedness     Endianess value<0 Size[bit] Base10
#> 1   unsigned Little-Endian   FALSE         4     12
y <- rdiversity:::switchEndianess(x, stickyBits=TRUE); print(y); summary(y);
#> [1] 1 1 0 0
#>   Signedness     Endianess value<0 Size[bit] Base10
#> 1   unsigned Little-Endian   FALSE         4      3