]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/kernel/region.h
Initial checkin from Perforce.
[polintos/scott/priv.git] / include / c++ / kernel / region.h
1 #ifndef _KERNEL_REGION_H
2 #define _KERNEL_REGION_H
3
4 #include <System/Mem.h>
5
6 // Overlapping regions are not well ordered.
7
8 static inline bool operator <(::System::Mem::Region &left,
9                               ::System::Mem::Region &right)
10 {
11         return left.start < right.start;
12 }
13
14 static inline bool operator <(::System::Mem::Region &left, uint64_t right)
15 {
16         return left.end < right;
17 }
18
19 static inline bool operator >(::System::Mem::Region &left, uint64_t right)
20 {
21         return left.start > right;
22 }
23
24 namespace Mem {
25         static inline ::System::Mem::RegionWithOffset
26         add_offset(::System::Mem::Region &region)
27         {
28                 ::System::Mem::RegionWithOffset ret;
29                 ret.start = region.start;
30                 ret.end = region.end;
31                 ret.offset = 0;
32                 return ret;
33         }
34
35         static inline ::System::Mem::Region
36         remove_offset(::System::Mem::RegionWithOffset &region)
37         {
38                 ::System::Mem::Region ret;
39                 ret.start = region.start;
40                 ret.end = region.end;
41                 return ret;
42         }
43 }
44
45 #endif