xref: /haiku/src/add-ons/disk_systems/gpt/Utility.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2013, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef UTILITY_H
6 #define UTILITY_H
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 static inline off_t
13 round_down(off_t a, uint32 b)
14 {
15 	return a / b * b;
16 }
17 
18 
19 static inline off_t
20 round_up(off_t a, uint32 b)
21 {
22 	return round_down(a + b - 1, b);
23 }
24 
25 
26 #endif	// UTILITY_H
27