bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
float_byteswap.cc
1// Created by KY 2/27/2024
2#include "float_byteswap.h"
3#include <algorithm>
4#include <cstddef>
5
6void swap_float32(char* buf, int64_t num) {
7
8 char *temp_buf = buf;
9 while (num--) {
10 for (size_t i = 0; i <sizeof(float)/2;i++)
11 std::swap(temp_buf[i],temp_buf[sizeof(float)-i-1]);
12 temp_buf = temp_buf + sizeof(float);
13 }
14}
15
16void swap_float64(char* buf, int64_t num) {
17
18 char *temp_buf = buf;
19 while (num--) {
20 for (size_t i = 0; i <sizeof(double)/2;i++)
21 std::swap(temp_buf[i],temp_buf[sizeof(double)-i-1]);
22 temp_buf = temp_buf + sizeof(double);
23 }
24}