CUBRID Engine  latest
align.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #ifndef HL_ALIGN_H
4 #define HL_ALIGN_H
5 
6 #include <stdlib.h>
7 
8 #if defined(__clang__)
9 #pragma clang diagnostic push
10 #pragma clang diagnostic ignored "-Wunused-variable"
11 #endif
12 
13 namespace HL {
14 
18  template <size_t Alignment>
19  inline size_t align (size_t v) {
20  static_assert((Alignment & (Alignment-1)) == 0,
21  "Alignment must be a power of two.");
22  return ((v + (Alignment-1)) & ~(Alignment-1));
23  }
24 
25 }
26 
27 #if defined(__clang__)
28 #pragma clang diagnostic pop
29 #endif
30 
31 #endif
size_t align(size_t v)
Definition: align.h:19
Definition: heaplayers.h:34