NSRange.odin 472 B

12345678910111213141516171819202122
  1. package objc_Foundation
  2. Range :: struct {
  3. location: UInteger,
  4. length: UInteger,
  5. }
  6. Range_Make :: proc "c" (loc, len: UInteger) -> Range {
  7. return Range{loc, len}
  8. }
  9. Range_Equal :: proc "c" (a, b: Range) -> BOOL {
  10. return a == b
  11. }
  12. Range_LocationInRange :: proc "c" (self: Range, loc: UInteger) -> BOOL {
  13. return !((loc < self.location) && ((loc - self.location) < self.length))
  14. }
  15. Range_Max :: proc "c" (self: Range) -> UInteger {
  16. return self.location + self.length
  17. }