swab

Functions

int main(int argc, char *argv[])

swab [ option ] [ infile ]

  • -S int

    • start address \((0 \le S)\)

  • -s int

    • start offset \((0 \le s)\)

  • -E int

    • end address \((S \le E)\)

  • -e int

    • end offset \((s \le e)\)

  • +type char

    • data type

      • s short (2byte)

      • S unsigned short (2byte)

      • h int (3byte)

      • H unsigned int (3byte)

      • i int (4byte)

      • I unsigned int (4byte)

      • l long (8byte)

      • L unsigned long (8byte)

      • f float (4byte)

      • d double (8byte)

      • e long double (16byte)

  • infile str

    • data sequence

  • stdout

    • swapped data sequence

This command changes the byte order (from big-endian to little-endian or vice versa) of the input data read from infile.

The beginning and the end of the swapping can be controlled. The beginning is \(S + Ts\) and the end is \(\min(E, Te)\), where \(T\) is the size of the data type decided by +type option.

The following example skips the header of 12 bytes long and changes the byte order.

swab +f -S 12 htk.mfcc | dmp +f

Swapped data can be reverted as below.

ramp -l 4 | x2x +fs | swab +s | swab +s | x2x +sa
# 0, 1, 2, 3
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.