212-byteshift_portability.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --- a/tools/include/tools/be_byteshift.h
  2. +++ b/tools/include/tools/be_byteshift.h
  3. @@ -1,7 +1,11 @@
  4. #ifndef _TOOLS_BE_BYTESHIFT_H
  5. #define _TOOLS_BE_BYTESHIFT_H
  6. +#ifdef __linux__
  7. #include <linux/types.h>
  8. +#else
  9. +#include "linux_types.h"
  10. +#endif
  11. static inline __u16 __get_unaligned_be16(const __u8 *p)
  12. {
  13. --- a/tools/include/tools/le_byteshift.h
  14. +++ b/tools/include/tools/le_byteshift.h
  15. @@ -1,7 +1,11 @@
  16. #ifndef _TOOLS_LE_BYTESHIFT_H
  17. #define _TOOLS_LE_BYTESHIFT_H
  18. +#ifdef __linux__
  19. #include <linux/types.h>
  20. +#else
  21. +#include "linux_types.h"
  22. +#endif
  23. static inline __u16 __get_unaligned_le16(const __u8 *p)
  24. {
  25. --- /dev/null
  26. +++ b/tools/include/tools/linux_types.h
  27. @@ -0,0 +1,22 @@
  28. +#ifndef __LINUX_TYPES_H
  29. +#define __LINUX_TYPES_H
  30. +
  31. +#include <stdint.h>
  32. +
  33. +typedef uint8_t __u8;
  34. +typedef uint8_t __be8;
  35. +typedef uint8_t __le8;
  36. +
  37. +typedef uint16_t __u16;
  38. +typedef uint16_t __be16;
  39. +typedef uint16_t __le16;
  40. +
  41. +typedef uint32_t __u32;
  42. +typedef uint32_t __be32;
  43. +typedef uint32_t __le32;
  44. +
  45. +typedef uint64_t __u64;
  46. +typedef uint64_t __be64;
  47. +typedef uint64_t __le64;
  48. +
  49. +#endif