MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / switch_endianness2

Function switch_endianness2

Source/astcenccli_image_load_store.cpp:660–673  ·  view source on GitHub ↗

* @brief Swap endianness of N two byte values. * * @param[in,out] dataptr The data to convert. * @param byte_count The number of bytes to convert. */

Source from the content-addressed store, hash-verified

658 * @param byte_count The number of bytes to convert.
659 */
660static void switch_endianness2(
661 void* dataptr,
662 size_t byte_count
663) {
664 uint8_t* data = reinterpret_cast<uint8_t*>(dataptr);
665 for (size_t i = 0; i < byte_count / 2; i++)
666 {
667 uint8_t d0 = data[0];
668 uint8_t d1 = data[1];
669 data[0] = d1;
670 data[1] = d0;
671 data += 2;
672 }
673}
674
675/**
676 * @brief Swap endianness of N four byte values.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected