aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin/Foundation/NSRange.odin
diff options
context:
space:
mode:
Diffstat (limited to 'core/sys/darwin/Foundation/NSRange.odin')
-rw-r--r--core/sys/darwin/Foundation/NSRange.odin22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/sys/darwin/Foundation/NSRange.odin b/core/sys/darwin/Foundation/NSRange.odin
new file mode 100644
index 000000000..dcb100e91
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSRange.odin
@@ -0,0 +1,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
+} \ No newline at end of file