/***************************************************************************
 * File Name: type.h
 * Description: 名称显式体现字节长度的类型定义（默认1字节对齐）
 * Author: [Your Name/Team Name]
 * Date Created: [YYYY-MM-DD]
 * Version: 3.0（纯宏定义版 | 零标准库依赖 + 零冲突 + 全平台兼容 + 彻底解决C2371）
 ***************************************************************************/
#ifndef _TYPE_H_
#define _TYPE_H_

/* -------------------------- 字节对齐控制宏（原样保留） -------------------------- */
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#define PACKED __attribute__((packed))
#define ALIGNED(x) __attribute__((aligned(x)))
#define BEGIN_PACKED PACKED
#define END_PACKED
#elif defined(_MSC_VER)
#define PACKED __pragma(pack(push, 1))
#define PACKED_END __pragma(pop)
#define BEGIN_PACKED PACKED
#define END_PACKED PACKED_END
#define ALIGNED(x) __declspec(align(x))
#else
#define PACKED
#define PACKED_END
#define BEGIN_PACKED
#define END_PACKED
#define ALIGNED(x)
#endif

/* -------------------------- ✅ 布尔类型 纯#define 无任何重定义 -------------------------- */
#define bool_xxl            unsigned char
#define true_xxl            1U
#define false_xxl           0U
#define bool8_xxl           bool_xxl
#define BOOL8_TRUE_XXL      true_xxl
#define BOOL8_FALSE_XXL     false_xxl


#define UINT32_XXL_MAX      0xFFFFFFFFU

/* -------------------------- ✅ 无符号整型 纯#define 核心解决C2371 -------------------------- */
#define uint8_xxl           unsigned char
#define uint16_xxl          unsigned short
#define uint32_xxl          unsigned int
#define uint64_xxl          unsigned long long

/* -------------------------- ✅ 有符号整型 纯#define -------------------------- */
#define int8_xxl            signed char
#define int16_xxl           signed short
#define int32_xxl           signed int
#define int64_xxl           signed long long

/* -------------------------- ✅ 指针类型 纯#define -------------------------- */
#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__arm64__)
#define uintptr_xxl         uint64_xxl
#define intptr_xxl          int64_xxl
#else
#define uintptr_xxl         uint32_xxl
#define intptr_xxl          int32_xxl
#endif

/* -------------------------- ✅ 字符/长度类型 纯#define -------------------------- */
#define char_xxl          char
#define uchar_xxl         unsigned char
#define size_xxl            uint32_xxl
#define ssize_xxl           int32_xxl
#define sizet32_xxl         uint32_xxl
#define ssizet32_xxl        int32_xxl

#define STANDARD_SIZE_T     size_xxl
#define SIZEOF_TB(x)        (sizeof(x) / sizeof((x)[0]))

#ifndef NULL
#define NULL                ((void *)0)
#endif

/* -------------------------- ✅ 兼容 false/bool/true 未声明报错 -------------------------- */
#define bool  bool_xxl
#define true  true_xxl
#define false false_xxl

#endif /* _TYPE_H_ */
