aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
blob: e4eebb0c5f7d0709d4f6bd06a1070a9ee782d870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (C) 2020-2021  Tomasz Kramkowski <tk@the-tk.com>
 * SPDX-License-Identifier: MIT
 */
#ifndef PACK_COMMON_H
#define PACK_COMMON_H

#include <limits.h>
#include <stddef.h>

#define BITMASK(n) (UINTMAX_MAX >> (sizeof (uintmax_t) * CHAR_BIT - n))

#ifndef PRIuSIZE
   #ifdef _WIN32
      #ifdef _WIN64
         #define PRIuSIZE PRIu64
      #else
         #define PRIuSIZE PRIu32
      #endif
   #else
      #define PRIuSIZE "zu"
   #endif
#endif

enum endian { BIG, LITTLE };

size_t getsize(char c);

#endif // !PACK_COMMON_H