Table of Contents
stream_set_byte_order
Configures the byte order used by the stream for multi-byte data types.
stream_set_byte_order(stream, byte_order) % Use specified byte order stream_set_byte_order(stream) % Use native byte order (no byte swapping)
Determines whether the functions that send and receive int16's, int32's, int64's, floats or doubles, or arrays of them, swap the bytes in the individual values. Byte swapping is performed when the given byte_order does not match the native byte order of the underlying platform.
For example, Intel processors are little endian (LSB first) while Motorola processors tend to be big endian (MSB first). By default, no byte swapping takes place.
If the byte_order is set to 0 (native endian) or omitted then the native byte order of the underlying platform is used and no byte swapping takes place. Native endian is the default byte order.
If the byte_order is set to 1 (little endian) and the underlying platform is little endian then no byte swapping takes place. However, if the underlying platform is big endian, then byte swapping is performed on all multi-byte data types sent or received over the stream.
If the byte_order is set to 2 (big endian) and the underlying platform is big endian then no byte swapping takes place. However, if the underlying platform is little endian, then byte swapping is performed on all multi-byte data types sent or received over the stream.
Note that stream_set_byte_order and stream_set_swap_bytes override each other, so byte swapping is performed according to the last function called.
This operation is not valid on listening streams created using stream_listen.
stream
Stream handle returned by stream_connect or stream_accept.
byte_order
The desired byte order for multi-byte data types. Valid byte orders are:
Value |
Meaning |
---|---|
0 |
Native byte order (no byte swapping performed) |
1 |
Little endian byte order (byte swapping performed if platform is big endian) |
2 |
Big endian byte order (byte swapping performed if platform is little endian) |
If this argument is not specified it defaults to 0 (native endian byte order).
This function has no outputs.
stream_set_byte_order(stream, 1); % Use little endian byte order for this stream
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.