aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin/Foundation/NSRange.odin
blob: dcb100e919fc85e993bc92266e7eb477bf57aa14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package objc_Foundation

Range :: struct {
	location: UInteger,
	length:  UInteger,
}

Range_Make :: proc "c" (loc, len: UInteger) -> Range {
	return Range{loc, len}
}

Range_Equal :: proc "c" (a, b: Range) -> BOOL {
	return a == b
}

Range_LocationInRange :: proc "c" (self: Range, loc: UInteger) -> BOOL {
	return !((loc < self.location) && ((loc - self.location) < self.length))
}

Range_Max :: proc "c" (self: Range) -> UInteger {
	return self.location + self.length
}