EndianPortable.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2011 Apple Inc. All rights reserved.
  3. *
  4. * @APPLE_APACHE_LICENSE_HEADER_START@
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * @APPLE_APACHE_LICENSE_HEADER_END@
  19. */
  20. //
  21. // EndianPortable.h
  22. //
  23. // Copyright 2011 Apple Inc. All rights reserved.
  24. //
  25. #ifndef _EndianPortable_h
  26. #define _EndianPortable_h
  27. #include <stdint.h>
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. uint16_t Swap16NtoB(uint16_t inUInt16);
  32. uint16_t Swap16BtoN(uint16_t inUInt16);
  33. uint32_t Swap32NtoB(uint32_t inUInt32);
  34. uint32_t Swap32BtoN(uint32_t inUInt32);
  35. uint64_t Swap64BtoN(uint64_t inUInt64);
  36. uint64_t Swap64NtoB(uint64_t inUInt64);
  37. float SwapFloat32BtoN(float in);
  38. float SwapFloat32NtoB(float in);
  39. double SwapFloat64BtoN(double in);
  40. double SwapFloat64NtoB(double in);
  41. void Swap16(uint16_t * inUInt16);
  42. void Swap24(uint8_t * inUInt24);
  43. void Swap32(uint32_t * inUInt32);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif