본문 바로가기
개발 언어/cpp

uint32_t 자료형이란?

by eeeun:) 2022. 1. 14.
반응형

C와 CPP에 등록되어 있는 자료형은 아니고, <stdint.h>에 typedef 되어 자료형처럼 사용!

 

앞에 u가 붙어있으면 unsigned라는 뜻

uint32_t = unsigned int 32비트 자료형

 

밑에 코드는 stdint.h에 정의된 자료형

typedef signed char        int8_t;
typedef short              int16_t;
typedef int                int32_t;
typedef long long          int64_t;
typedef unsigned char      uint8_t;
typedef unsigned short     uint16_t;
typedef unsigned int       uint32_t;
typedef unsigned long long uint64_t;
 
typedef signed char        int_least8_t;
typedef short              int_least16_t;
typedef int                int_least32_t;
typedef long long          int_least64_t;
typedef unsigned char      uint_least8_t;
typedef unsigned short     uint_least16_t;
typedef unsigned int       uint_least32_t;
typedef unsigned long long uint_least64_t;
 
typedef signed char        int_fast8_t;
typedef int                int_fast16_t;
typedef int                int_fast32_t;
typedef long long          int_fast64_t;
typedef unsigned char      uint_fast8_t;
typedef unsigned int       uint_fast16_t;
typedef unsigned int       uint_fast32_t;
typedef unsigned long long uint_fast64_t;
 
typedef long long          intmax_t;
typedef unsigned long long uintmax_t;

 

stdint.h에 정의된 정수 범위의 대한 크기 값

#define INT8_MIN         (-127i8 - 1)
#define INT16_MIN        (-32767i16 - 1)
#define INT32_MIN        (-2147483647i32 - 1)
#define INT64_MIN        (-9223372036854775807i64 - 1)
#define INT8_MAX         127i8
#define INT16_MAX        32767i16
#define INT32_MAX        2147483647i32
#define INT64_MAX        9223372036854775807i64
#define UINT8_MAX        0xffui8
#define UINT16_MAX       0xffffui16
#define UINT32_MAX       0xffffffffui32
#define UINT64_MAX       0xffffffffffffffffui64

 

uint32_t와 unit_fast32_t의 차이점

728x90

댓글