mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-19 05:05:45 +01:00
define short-hand types for int32/uint32 et cetera
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../types.h"
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define bswap16 __builtin_bswap16
|
||||
@@ -19,18 +19,18 @@
|
||||
#endif
|
||||
|
||||
#if defined(IMPL_BSWAP) || !defined(NDEBUG)
|
||||
static inline uint16_t bswap16_impl(uint16_t x) {
|
||||
static inline u16 bswap16_impl(u16 x) {
|
||||
return (x << 8) | (x >> 8);
|
||||
}
|
||||
|
||||
static inline uint32_t bswap32_impl(uint32_t x) {
|
||||
static inline u32 bswap32_impl(u32 x) {
|
||||
return (x << 24) |
|
||||
((0x0000FF00U & x) << 8) |
|
||||
((0x00FF0000U & x) >> 8) |
|
||||
(x >> 24);
|
||||
}
|
||||
|
||||
static inline uint64_t bswap64_impl(uint64_t x) {
|
||||
static inline u64 bswap64_impl(u64 x) {
|
||||
return (x << 56) |
|
||||
((0x000000000000FF00ULL & x) << 40) |
|
||||
((0x0000000000FF0000ULL & x) << 24) |
|
||||
|
||||
Reference in New Issue
Block a user