mirror of
https://github.com/dgibson/dtc.git
synced 2026-04-11 16:37:42 -04:00
Remove invalid macro starting with _ from libfdt_env.h
libfdt_env.h in the device tree compiler currently defines a _B() macro. This is in the namespace reserved for the implementation, and Cygwin's ctype.h actually defines a macro with this name. This renames _B to EXTRACT_BYTE. Signed-off-by: Bert Kenward <bert.kenward@broadcom.com>
This commit is contained in:
parent
5f0c3b2d62
commit
37b167f68a
1 changed files with 6 additions and 6 deletions
|
|
@ -5,25 +5,25 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
|
||||
#define EXTRACT_BYTE(n) ((unsigned long long)((uint8_t *)&x)[n])
|
||||
static inline uint16_t fdt16_to_cpu(uint16_t x)
|
||||
{
|
||||
return (_B(0) << 8) | _B(1);
|
||||
return (EXTRACT_BYTE(0) << 8) | EXTRACT_BYTE(1);
|
||||
}
|
||||
#define cpu_to_fdt16(x) fdt16_to_cpu(x)
|
||||
|
||||
static inline uint32_t fdt32_to_cpu(uint32_t x)
|
||||
{
|
||||
return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
|
||||
return (EXTRACT_BYTE(0) << 24) | (EXTRACT_BYTE(1) << 16) | (EXTRACT_BYTE(2) << 8) | EXTRACT_BYTE(3);
|
||||
}
|
||||
#define cpu_to_fdt32(x) fdt32_to_cpu(x)
|
||||
|
||||
static inline uint64_t fdt64_to_cpu(uint64_t x)
|
||||
{
|
||||
return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
|
||||
| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
|
||||
return (EXTRACT_BYTE(0) << 56) | (EXTRACT_BYTE(1) << 48) | (EXTRACT_BYTE(2) << 40) | (EXTRACT_BYTE(3) << 32)
|
||||
| (EXTRACT_BYTE(4) << 24) | (EXTRACT_BYTE(5) << 16) | (EXTRACT_BYTE(6) << 8) | EXTRACT_BYTE(7);
|
||||
}
|
||||
#define cpu_to_fdt64(x) fdt64_to_cpu(x)
|
||||
#undef _B
|
||||
#undef EXTRACT_BYTE
|
||||
|
||||
#endif /* _LIBFDT_ENV_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue