- int fixed = (int)(val * 65536.0f);
- if (binary_byte_order == BYTE_ORDER_MATCHES_NETWORK_ORDER) {
- *((int32_t*)&buf[length]) = (int32_t)fixed;
- } else {
- *((uint32_t*)&buf[length]) = sg_bswap_32((uint32_t)fixed);
+ int32_t fixed = (int)(val * 65536.0f);
+ if (binary_byte_order != BYTE_ORDER_MATCHES_NETWORK_ORDER) {
+ fixed = (int32_t) sg_bswap_32((uint32_t)fixed);