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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// Definition of macros from sys/param.h.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_SYS_PARAM_MACROS_H
#define LLVM_LIBC_MACROS_SYS_PARAM_MACROS_H
#include "limits-macros.h"
// Number Bits per BYte
#ifndef NBBY
#ifdef __CHAR_BIT__
#define NBBY __CHAR_BIT__
#else
#define NBBY 8
#endif
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef howmany
#define howmany(n, d) (((n) + ((d) - 1)) / (d))
#endif
#ifndef roundup
#define roundup(n, d) (howmany(n, d) * (d))
#endif
#ifndef powerof2
#define powerof2(n) !(((n) - 1) & (n))
#endif
#ifndef MAXPATHLEN
#ifdef PATH_MAX
#define MAXPATHLEN PATH_MAX
#else
#define MAXPATHLEN 4096
#endif
#endif
#endif // LLVM_LIBC_MACROS_SYS_PARAM_MACROS_H