/*
 *
 * Copyright 2017 Asylo authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_
#define ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_


#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

inline uint16_t bswap_16(uint16_t n) { return __builtin_bswap16(n); }

inline uint32_t bswap_32(uint32_t n) { return __builtin_bswap32(n); }

inline uint64_t bswap_64(uint64_t n) { return __builtin_bswap64(n); }

#ifdef __cplusplus
}
#endif

#endif  // ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

/*
 *
 * Copyright 2017 Asylo authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_
#define ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_


#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

inline uint16_t bswap_16(const uint16_t &n) { return __builtin_bswap16(n); }

inline uint32_t bswap_32(const uint32_t &n) { return __builtin_bswap32(n); }

inline uint64_t bswap_64(const uint64_t &n) { return __builtin_bswap64(n); }

#ifdef __cplusplus
}
#endif

#endif  // ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

--- 
+++ 
@@ -26,11 +26,11 @@
 extern "C" {
 #endif
 
-inline uint16_t bswap_16(const uint16_t &n) { return __builtin_bswap16(n); }
+inline uint16_t bswap_16(uint16_t n) { return __builtin_bswap16(n); }
 
-inline uint32_t bswap_32(const uint32_t &n) { return __builtin_bswap32(n); }
+inline uint32_t bswap_32(uint32_t n) { return __builtin_bswap32(n); }
 
-inline uint64_t bswap_64(const uint64_t &n) { return __builtin_bswap64(n); }
+inline uint64_t bswap_64(uint64_t n) { return __builtin_bswap64(n); }
 
 #ifdef __cplusplus
 }
Remove pass by reference in bswap functions

This is a simple bug fix to make these functions compatible with C
instead of only with C++.

PiperOrigin-RevId: 205919772
