1  ------------------------------------------------------------------
   2  -- This file was autogenerated by 'writeNumbers', do not modify --
   3  ------------------------------------------------------------------
   4  
   5  package frost.core
   6  
   7  uses frost.unsafe.Pointer
   8  
   9  ===
  10  A signed 32 or 64 bit integer, as appropriate for the target architecture.
  11  ===
  12  class Int : Value, HashKey<Int>, Comparable<Int>, Formattable {
  13      @private
  14      class Bits : ListView<Bit> {
  15          def value:Int
  16          init(value:Int) {
  17              self.value := value
  18          }
  19  
  20          ===Returns a single bit from this number, where index 0 is the least significant bit.===
  21          @override
  22          function [](index:Int):Bit {
  23              return value && (1 << index) != 0
  24          }
  25  
  26          ===
  27          Returns the number of bits in this integer.
  28          ===
  29          @override
  30          function get_count():Int {
  31              return $int_size
  32          }
  33  
  34          @override
  35          function get_iterator():Iterator<Bit> {
  36              return org.frostlang.frost.IntBitIterator(value.toUInt64, 1 << ($int_size->builtin_uint64 - 1))
  37          }
  38      }
  39      ===
  40      The smallest value this type can hold.
  41      ===
  42      constant MIN:Int := -1 << ($int_size - 1)
  43  
  44      ===
  45      The largest value this type can hold.
  46      ===
  47      constant MAX:Int := 1 << ($int_size - 1) -& 1
  48  
  49      @package
  50      def value:builtin_int
  51  
  52      ===@hidden===
  53      @implicit
  54      @priority(1)
  55      init(value:builtin_int) {
  56          self.value := value
  57      }
  58  
  59      ===@hidden===
  60      @implicit
  61      @priority(-5)
  62      init(value:Int8) {
  63          self.value := value.value->builtin_int
  64      }
  65  
  66      ===@hidden===
  67      @implicit
  68      @priority(-4)
  69      init(value:Int16) {
  70          self.value := value.value->builtin_int
  71      }
  72  
  73      ===@hidden===
  74      @implicit
  75      @priority(-2)
  76      init(value:UInt8) {
  77          self.value := value.value->builtin_int
  78      }
  79  
  80      ===@hidden===
  81      @implicit
  82      @priority(-1)
  83      init(value:UInt16) {
  84          self.value := value.value->builtin_int
  85      }
  86  
  87      ===Adds another number to this number.===
  88      @priority(14)
  89      function +(other:Int32):Int32 {
  90          return value->builtin_int32 + other.value
  91      }
  92  
  93      ===Adds another number to this number.===
  94      @priority(16)
  95      function +(other:Int64):Int64 {
  96          return value->builtin_int64 + other.value
  97      }
  98  
  99      ===Adds another number to this number.===
 100      @priority(20)
 101      function +(other:Int):Int {
 102          return value + other.value
 103      }
 104  
 105      ===Adds another number to this number.===
 106      @priority(13)
 107      function +(other:UInt32):Int64 {
 108          return value->builtin_int64 + other.value->builtin_int64
 109      }
 110  
 111      ===Adds another number to this number.===
 112      @priority(17)
 113      function +(other:UInt):Int64 {
 114          return value->builtin_int64 + other.value->builtin_int64
 115      }
 116  
 117      ===Adds another number to this number without checking for overflow.===
 118      @priority(14)
 119      function +&(other:Int32):Int32 {
 120          return value->builtin_int32 +& other.value
 121      }
 122  
 123      ===Adds another number to this number without checking for overflow.===
 124      @priority(16)
 125      function +&(other:Int64):Int64 {
 126          return value->builtin_int64 +& other.value
 127      }
 128  
 129      ===Adds another number to this number without checking for overflow.===
 130      @priority(20)
 131      function +&(other:Int):Int {
 132          return value +& other.value
 133      }
 134  
 135      ===Adds another number to this number without checking for overflow.===
 136      @priority(13)
 137      function +&(other:UInt32):Int64 {
 138          return value->builtin_int64 +& other.value->builtin_int64
 139      }
 140  
 141      ===Adds another number to this number without checking for overflow.===
 142      @priority(17)
 143      function +&(other:UInt):Int64 {
 144          return value->builtin_int64 +& other.value->builtin_int64
 145      }
 146  
 147      ===Subtracts another number from this number.===
 148      @priority(14)
 149      function -(other:Int32):Int32 {
 150          return value->builtin_int32 - other.value
 151      }
 152  
 153      ===Subtracts another number from this number.===
 154      @priority(16)
 155      function -(other:Int64):Int64 {
 156          return value->builtin_int64 - other.value
 157      }
 158  
 159      ===Subtracts another number from this number.===
 160      @priority(20)
 161      function -(other:Int):Int {
 162          return value - other.value
 163      }
 164  
 165      ===Subtracts another number from this number.===
 166      @priority(13)
 167      function -(other:UInt32):Int64 {
 168          return value->builtin_int64 - other.value->builtin_int64
 169      }
 170  
 171      ===Subtracts another number from this number.===
 172      @priority(17)
 173      function -(other:UInt):Int64 {
 174          return value->builtin_int64 - other.value->builtin_int64
 175      }
 176  
 177      ===Subtracts another number from this number without checking for overflow.===
 178      @priority(14)
 179      function -&(other:Int32):Int32 {
 180          return value->builtin_int32 -& other.value
 181      }
 182  
 183      ===Subtracts another number from this number without checking for overflow.===
 184      @priority(16)
 185      function -&(other:Int64):Int64 {
 186          return value->builtin_int64 -& other.value
 187      }
 188  
 189      ===Subtracts another number from this number without checking for overflow.===
 190      @priority(20)
 191      function -&(other:Int):Int {
 192          return value -& other.value
 193      }
 194  
 195      ===Subtracts another number from this number without checking for overflow.===
 196      @priority(13)
 197      function -&(other:UInt32):Int64 {
 198          return value->builtin_int64 -& other.value->builtin_int64
 199      }
 200  
 201      ===Subtracts another number from this number without checking for overflow.===
 202      @priority(17)
 203      function -&(other:UInt):Int64 {
 204          return value->builtin_int64 -& other.value->builtin_int64
 205      }
 206  
 207      ===Returns the negation (additive inverse) of this number===
 208      function -():Int {
 209          return Int(-value)
 210      }
 211  
 212      ===Multiplies this number by another number.===
 213      @priority(14)
 214      function *(other:Int32):Int32 {
 215          return value->builtin_int32 * other.value
 216      }
 217  
 218      ===Multiplies this number by another number.===
 219      @priority(16)
 220      function *(other:Int64):Int64 {
 221          return value->builtin_int64 * other.value
 222      }
 223  
 224      ===Multiplies this number by another number.===
 225      @priority(20)
 226      function *(other:Int):Int {
 227          return value * other.value
 228      }
 229  
 230      ===Multiplies this number by another number.===
 231      @priority(13)
 232      function *(other:UInt32):Int64 {
 233          return value->builtin_int64 * other.value->builtin_int64
 234      }
 235  
 236      ===Multiplies this number by another number.===
 237      @priority(17)
 238      function *(other:UInt):Int64 {
 239          return value->builtin_int64 * other.value->builtin_int64
 240      }
 241  
 242      ===Multiplies this number by another number without checking for overflow.===
 243      @priority(14)
 244      function *&(other:Int32):Int32 {
 245          return value->builtin_int32 *& other.value
 246      }
 247  
 248      ===Multiplies this number by another number without checking for overflow.===
 249      @priority(16)
 250      function *&(other:Int64):Int64 {
 251          return value->builtin_int64 *& other.value
 252      }
 253  
 254      ===Multiplies this number by another number without checking for overflow.===
 255      @priority(20)
 256      function *&(other:Int):Int {
 257          return value *& other.value
 258      }
 259  
 260      ===Multiplies this number by another number without checking for overflow.===
 261      @priority(13)
 262      function *&(other:UInt32):Int64 {
 263          return value->builtin_int64 *& other.value->builtin_int64
 264      }
 265  
 266      ===Multiplies this number by another number without checking for overflow.===
 267      @priority(17)
 268      function *&(other:UInt):Int64 {
 269          return value->builtin_int64 *& other.value->builtin_int64
 270      }
 271  
 272      ===Divides this number by another number, returning the whole number portion.===
 273      @priority(14)
 274      function //(other:Int32):Int32 {
 275          return value->builtin_int32 // other.value
 276      }
 277  
 278      ===Divides this number by another number, returning the whole number portion.===
 279      @priority(16)
 280      function //(other:Int64):Int64 {
 281          return value->builtin_int64 // other.value
 282      }
 283  
 284      ===Divides this number by another number, returning the whole number portion.===
 285      @priority(20)
 286      function //(other:Int):Int {
 287          return value // other.value
 288      }
 289  
 290      ===Divides this number by another number, returning the whole number portion.===
 291      @priority(13)
 292      function //(other:UInt32):Int64 {
 293          return value->builtin_int64 // other.value->builtin_int64
 294      }
 295  
 296      ===Divides this number by another number, returning the whole number portion.===
 297      @priority(17)
 298      function //(other:UInt):Int64 {
 299          return value->builtin_int64 // other.value->builtin_int64
 300      }
 301  
 302      ===Divides this number by another number, returning the whole number portion, without checking for overflow.===
 303      @priority(14)
 304      function //&(other:Int32):Int32 {
 305          return value->builtin_int32 //& other.value
 306      }
 307  
 308      ===Divides this number by another number, returning the whole number portion, without checking for overflow.===
 309      @priority(16)
 310      function //&(other:Int64):Int64 {
 311          return value->builtin_int64 //& other.value
 312      }
 313  
 314      ===Divides this number by another number, returning the whole number portion, without checking for overflow.===
 315      @priority(20)
 316      function //&(other:Int):Int {
 317          return value //& other.value
 318      }
 319  
 320      ===Divides this number by another number, returning the whole number portion, without checking for overflow.===
 321      @priority(13)
 322      function //&(other:UInt32):Int64 {
 323          return value->builtin_int64 //& other.value->builtin_int64
 324      }
 325  
 326      ===Divides this number by another number, returning the whole number portion, without checking for overflow.===
 327      @priority(17)
 328      function //&(other:UInt):Int64 {
 329          return value->builtin_int64 //& other.value->builtin_int64
 330      }
 331  
 332      ===Returns the remainder of dividing this number by another number.===
 333      @priority(14)
 334      function %(other:Int32):Int32 {
 335          return value->builtin_int32 % other.value
 336      }
 337  
 338      ===Returns the remainder of dividing this number by another number.===
 339      @priority(16)
 340      function %(other:Int64):Int64 {
 341          return value->builtin_int64 % other.value
 342      }
 343  
 344      ===Returns the remainder of dividing this number by another number.===
 345      @priority(20)
 346      function %(other:Int):Int {
 347          return value % other.value
 348      }
 349  
 350      ===Returns the remainder of dividing this number by another number.===
 351      @priority(13)
 352      function %(other:UInt32):Int64 {
 353          return value->builtin_int64 % other.value->builtin_int64
 354      }
 355  
 356      ===Returns the remainder of dividing this number by another number.===
 357      @priority(17)
 358      function %(other:UInt):Int64 {
 359          return value->builtin_int64 % other.value->builtin_int64
 360      }
 361  
 362      ===Divides this number by another number.===
 363      @priority(10)
 364      function /(other:Int8):Real32 {
 365          return value->builtin_float32 / other.value->builtin_float32
 366      }
 367  
 368      ===Divides this number by another number.===
 369      @priority(12)
 370      function /(other:Int16):Real32 {
 371          return value->builtin_float32 / other.value->builtin_float32
 372      }
 373  
 374      ===Divides this number by another number.===
 375      @priority(14)
 376      function /(other:Int32):Real32 {
 377          return value->builtin_float32 / other.value->builtin_float32
 378      }
 379  
 380      ===Divides this number by another number.===
 381      @priority(16)
 382      function /(other:Int64):Real64 {
 383          return value->builtin_float64 / other.value->builtin_float64
 384      }
 385  
 386      ===Divides this number by another number.===
 387      @priority(9)
 388      function /(other:UInt8):Real32 {
 389          return value->builtin_float32 / other.value->builtin_float32
 390      }
 391  
 392      ===Divides this number by another number.===
 393      @priority(11)
 394      function /(other:UInt16):Real32 {
 395          return value->builtin_float32 / other.value->builtin_float32
 396      }
 397  
 398      ===Divides this number by another number.===
 399      @priority(13)
 400      function /(other:UInt32):Real32 {
 401          return value->builtin_float32 / other.value->builtin_float32
 402      }
 403  
 404      ===Divides this number by another number.===
 405      @priority(15)
 406      function /(other:UInt64):Real64 {
 407          return value->builtin_float64 / other.value->builtin_float64
 408      }
 409  
 410      ===Divides this number by another number.===
 411      @priority(19)
 412      function /(other:Real32):Real32 {
 413          return value->builtin_float32 / other.value
 414      }
 415  
 416      ===Divides this number by another number.===
 417      @priority(20)
 418      function /(other:Real64):Real64 {
 419          return value->builtin_float64 / other.value
 420      }
 421  
 422      ===Returns the bitwise NOT of this number.===
 423      function !!():Int {
 424          return Int(!!value)
 425      }
 426  
 427      ===Returns the bitwise AND of this number with another number.===
 428      @priority(14)
 429      function &&(other:Int32):Int32 {
 430          return value->builtin_int32 && other.value
 431      }
 432  
 433      ===Returns the bitwise AND of this number with another number.===
 434      @priority(16)
 435      function &&(other:Int64):Int64 {
 436          return value->builtin_int64 && other.value
 437      }
 438  
 439      ===Returns the bitwise AND of this number with another number.===
 440      @priority(20)
 441      function &&(other:Int):Int {
 442          return value && other.value
 443      }
 444  
 445      ===Returns the bitwise AND of this number with another number.===
 446      @priority(13)
 447      function &&(other:UInt32):UInt32 {
 448          return value->builtin_uint32 && other.value
 449      }
 450  
 451      ===Returns the bitwise AND of this number with another number.===
 452      @priority(15)
 453      function &&(other:UInt64):UInt64 {
 454          return value->builtin_uint64 && other.value
 455      }
 456  
 457      ===Returns the bitwise AND of this number with another number.===
 458      @priority(17)
 459      function &&(other:UInt):UInt {
 460          return value->builtin_uint && other.value
 461      }
 462  
 463      ===Returns the bitwise OR of this number with another number.===
 464      @priority(14)
 465      function ||(other:Int32):Int32 {
 466          return value->builtin_int32 || other.value
 467      }
 468  
 469      ===Returns the bitwise OR of this number with another number.===
 470      @priority(16)
 471      function ||(other:Int64):Int64 {
 472          return value->builtin_int64 || other.value
 473      }
 474  
 475      ===Returns the bitwise OR of this number with another number.===
 476      @priority(20)
 477      function ||(other:Int):Int {
 478          return value || other.value
 479      }
 480  
 481      ===Returns the bitwise OR of this number with another number.===
 482      @priority(13)
 483      function ||(other:UInt32):UInt32 {
 484          return value->builtin_uint32 || other.value
 485      }
 486  
 487      ===Returns the bitwise OR of this number with another number.===
 488      @priority(15)
 489      function ||(other:UInt64):UInt64 {
 490          return value->builtin_uint64 || other.value
 491      }
 492  
 493      ===Returns the bitwise OR of this number with another number.===
 494      @priority(17)
 495      function ||(other:UInt):UInt {
 496          return value->builtin_uint || other.value
 497      }
 498  
 499      ===Returns the bitwise XOR of this number with another number.===
 500      @priority(14)
 501      function ~~(other:Int32):Int32 {
 502          return value->builtin_int32 ~~ other.value
 503      }
 504  
 505      ===Returns the bitwise XOR of this number with another number.===
 506      @priority(16)
 507      function ~~(other:Int64):Int64 {
 508          return value->builtin_int64 ~~ other.value
 509      }
 510  
 511      ===Returns the bitwise XOR of this number with another number.===
 512      @priority(20)
 513      function ~~(other:Int):Int {
 514          return value ~~ other.value
 515      }
 516  
 517      ===Returns the bitwise XOR of this number with another number.===
 518      @priority(13)
 519      function ~~(other:UInt32):UInt32 {
 520          return value->builtin_uint32 ~~ other.value
 521      }
 522  
 523      ===Returns the bitwise XOR of this number with another number.===
 524      @priority(15)
 525      function ~~(other:UInt64):UInt64 {
 526          return value->builtin_uint64 ~~ other.value
 527      }
 528  
 529      ===Returns the bitwise XOR of this number with another number.===
 530      @priority(17)
 531      function ~~(other:UInt):UInt {
 532          return value->builtin_uint ~~ other.value
 533      }
 534  
 535      ===Returns this number shifted left by the specified number of bits.===
 536      @priority(20)
 537      function <<(other:Int):Int {
 538          return value << other.value
 539      }
 540  
 541      ===Returns this number shifted left by the specified number of bits, without checking for overflow.===
 542      @priority(20)
 543      function <<&(other:Int):Int {
 544          return value <<& other.value
 545      }
 546  
 547      ===Returns this number arithmetic shifted right by the specified number of bits.===
 548      @priority(20)
 549      function >>(other:Int):Int {
 550          return value >> other.value
 551      }
 552  
 553      ===Returns `true` if this number is equal to the given number.===
 554      @priority(10)
 555      function =(other:Int8):Bit {
 556          return value = other.value->builtin_int
 557      }
 558  
 559      ===Returns `true` if this number is equal to the given number.===
 560      @priority(12)
 561      function =(other:Int16):Bit {
 562          return value = other.value->builtin_int
 563      }
 564  
 565      ===Returns `true` if this number is equal to the given number.===
 566      @priority(14)
 567      function =(other:Int32):Bit {
 568          return value->builtin_int32 = other.value
 569      }
 570  
 571      ===Returns `true` if this number is equal to the given number.===
 572      @priority(16)
 573      function =(other:Int64):Bit {
 574          return value->builtin_int64 = other.value
 575      }
 576  
 577      ===Returns `true` if this number is equal to the given number.===
 578      @override
 579      @priority(20)
 580      function =(other:Int):Bit {
 581          return value = other.value
 582      }
 583  
 584      ===Returns `true` if this number is equal to the given number.===
 585      @priority(9)
 586      function =(other:UInt8):Bit {
 587          return value->builtin_int64 = other.value->builtin_int64
 588      }
 589  
 590      ===Returns `true` if this number is equal to the given number.===
 591      @priority(11)
 592      function =(other:UInt16):Bit {
 593          return value->builtin_int64 = other.value->builtin_int64
 594      }
 595  
 596      ===Returns `true` if this number is equal to the given number.===
 597      @priority(13)
 598      function =(other:UInt32):Bit {
 599          return value->builtin_int64 = other.value->builtin_int64
 600      }
 601  
 602      ===Returns `true` if this number is equal to the given number.===
 603      @priority(17)
 604      function =(other:UInt):Bit {
 605          return value->builtin_int64 = other.value->builtin_int64
 606      }
 607  
 608      ===Returns `true` if this number is not equal to the given number.===
 609      @priority(10)
 610      function !=(other:Int8):Bit {
 611          return value != other.value->builtin_int
 612      }
 613  
 614      ===Returns `true` if this number is not equal to the given number.===
 615      @priority(12)
 616      function !=(other:Int16):Bit {
 617          return value != other.value->builtin_int
 618      }
 619  
 620      ===Returns `true` if this number is not equal to the given number.===
 621      @priority(14)
 622      function !=(other:Int32):Bit {
 623          return value->builtin_int32 != other.value
 624      }
 625  
 626      ===Returns `true` if this number is not equal to the given number.===
 627      @priority(16)
 628      function !=(other:Int64):Bit {
 629          return value->builtin_int64 != other.value
 630      }
 631  
 632      ===Returns `true` if this number is not equal to the given number.===
 633      @override
 634      @priority(20)
 635      function !=(other:Int):Bit {
 636          return value != other.value
 637      }
 638  
 639      ===Returns `true` if this number is not equal to the given number.===
 640      @priority(9)
 641      function !=(other:UInt8):Bit {
 642          return value->builtin_int64 != other.value->builtin_int64
 643      }
 644  
 645      ===Returns `true` if this number is not equal to the given number.===
 646      @priority(11)
 647      function !=(other:UInt16):Bit {
 648          return value->builtin_int64 != other.value->builtin_int64
 649      }
 650  
 651      ===Returns `true` if this number is not equal to the given number.===
 652      @priority(13)
 653      function !=(other:UInt32):Bit {
 654          return value->builtin_int64 != other.value->builtin_int64
 655      }
 656  
 657      ===Returns `true` if this number is not equal to the given number.===
 658      @priority(17)
 659      function !=(other:UInt):Bit {
 660          return value->builtin_int64 != other.value->builtin_int64
 661      }
 662  
 663      ===Returns `true` if this number is less than the given number.===
 664      @priority(10)
 665      function <(other:Int8):Bit {
 666          return value < other.value->< other.value->builtin_int
 667      }
 668  
 669      ===Returns `true` if this number is less than the given number.===
 670      @priority(12)
 671      function <(other:Int16):Bit {
 672          return value < other.value->< other.value->builtin_int
 673      }
 674  
 675      ===Returns `true` if this number is less than the given number.===
 676      @priority(14)
 677      function <(other:Int32):Bit {
 678          return value->builtin_int32 < other.value
 679      }< other.value
 680      }
 681  
 682      ===Returns `true` if this number is less than the given number.===
 683      @priority(16)
 684      function <(other:Int64):Bit {
 685          return value->builtin_int64 < other.value
 686      }< other.value
 687      }
 688  
 689      ===Returns `true` if this number is less than the given number.===
 690      @override
 691      @priority(20)
 692      function <(other:Int):Bit {
 693          return value < other.value
 694      }< other.value
 695      }
 696  
 697      ===Returns `true` if this number is less than the given number.===
 698      @priority(9)
 699      function <(other:UInt8):Bit {
 700          return value->builtin_int64 < other.value->< other.value->builtin_int64
 701      }
 702  
 703      ===Returns `true` if this number is less than the given number.===
 704      @priority(11)
 705      function <(other:UInt16):Bit {
 706          return value->builtin_int64 < other.value->< other.value->builtin_int64
 707      }
 708  
 709      ===Returns `true` if this number is less than the given number.===
 710      @priority(13)
 711      function <(other:UInt32):Bit {
 712          return value->builtin_int64 < other.value->< other.value->builtin_int64
 713      }
 714  
 715      ===Returns `true` if this number is less than the given number.===
 716      @priority(17)
 717      function <(other:UInt):Bit {
 718          return value->builtin_int64 < other.value->< other.value->builtin_int64
 719      }
 720  
 721      ===Returns `true` if this number is greater than the given number.===
 722      @priority(10)
 723      function >(other:Int8):Bit {
 724          return value > other.value->builtin_int
 725      }
 726  
 727      ===Returns `true` if this number is greater than the given number.===
 728      @priority(12)
 729      function >(other:Int16):Bit {
 730          return value > other.value->builtin_int
 731      }
 732  
 733      ===Returns `true` if this number is greater than the given number.===
 734      @priority(14)
 735      function >(other:Int32):Bit {
 736          return value->builtin_int32 > other.value
 737      }
 738  
 739      ===Returns `true` if this number is greater than the given number.===
 740      @priority(16)
 741      function >(other:Int64):Bit {
 742          return value->builtin_int64 > other.value
 743      }
 744  
 745      ===Returns `true` if this number is greater than the given number.===
 746      @override
 747      @priority(20)
 748      function >(other:Int):Bit {
 749          return value > other.value
 750      }
 751  
 752      ===Returns `true` if this number is greater than the given number.===
 753      @priority(9)
 754      function >(other:UInt8):Bit {
 755          return value->builtin_int64 > other.value->builtin_int64
 756      }
 757  
 758      ===Returns `true` if this number is greater than the given number.===
 759      @priority(11)
 760      function >(other:UInt16):Bit {
 761          return value->builtin_int64 > other.value->builtin_int64
 762      }
 763  
 764      ===Returns `true` if this number is greater than the given number.===
 765      @priority(13)
 766      function >(other:UInt32):Bit {
 767          return value->builtin_int64 > other.value->builtin_int64
 768      }
 769  
 770      ===Returns `true` if this number is greater than the given number.===
 771      @priority(17)
 772      function >(other:UInt):Bit {
 773          return value->builtin_int64 > other.value->builtin_int64
 774      }
 775  
 776      ===Returns `true` if this number is greater than or equal to the given number.===
 777      @priority(10)
 778      function >=(other:Int8):Bit {
 779          return value >= other.value->builtin_int
 780      }
 781  
 782      ===Returns `true` if this number is greater than or equal to the given number.===
 783      @priority(12)
 784      function >=(other:Int16):Bit {
 785          return value >= other.value->builtin_int
 786      }
 787  
 788      ===Returns `true` if this number is greater than or equal to the given number.===
 789      @priority(14)
 790      function >=(other:Int32):Bit {
 791          return value->builtin_int32 >= other.value
 792      }
 793  
 794      ===Returns `true` if this number is greater than or equal to the given number.===
 795      @priority(16)
 796      function >=(other:Int64):Bit {
 797          return value->builtin_int64 >= other.value
 798      }
 799  
 800      ===Returns `true` if this number is greater than or equal to the given number.===
 801      @override
 802      @priority(20)
 803      function >=(other:Int):Bit {
 804          return value >= other.value
 805      }
 806  
 807      ===Returns `true` if this number is greater than or equal to the given number.===
 808      @priority(9)
 809      function >=(other:UInt8):Bit {
 810          return value->builtin_int64 >= other.value->builtin_int64
 811      }
 812  
 813      ===Returns `true` if this number is greater than or equal to the given number.===
 814      @priority(11)
 815      function >=(other:UInt16):Bit {
 816          return value->builtin_int64 >= other.value->builtin_int64
 817      }
 818  
 819      ===Returns `true` if this number is greater than or equal to the given number.===
 820      @priority(13)
 821      function >=(other:UInt32):Bit {
 822          return value->builtin_int64 >= other.value->builtin_int64
 823      }
 824  
 825      ===Returns `true` if this number is greater than or equal to the given number.===
 826      @priority(17)
 827      function >=(other:UInt):Bit {
 828          return value->builtin_int64 >= other.value->builtin_int64
 829      }
 830  
 831      ===Returns `true` if this number is less than or equal to the given number.===
 832      @priority(10)
 833      function <=(other:Int8):Bit {
 834          return value <= other.value->builtin_int
 835      }
 836  
 837      ===Returns `true` if this number is less than or equal to the given number.===
 838      @priority(12)
 839      function <=(other:Int16):Bit {
 840          return value <= other.value->builtin_int
 841      }
 842  
 843      ===Returns `true` if this number is less than or equal to the given number.===
 844      @priority(14)
 845      function <=(other:Int32):Bit {
 846          return value->builtin_int32 <= other.value
 847      }
 848  
 849      ===Returns `true` if this number is less than or equal to the given number.===
 850      @priority(16)
 851      function <=(other:Int64):Bit {
 852          return value->builtin_int64 <= other.value
 853      }
 854  
 855      ===Returns `true` if this number is less than or equal to the given number.===
 856      @override
 857      @priority(20)
 858      function <=(other:Int):Bit {
 859          return value <= other.value
 860      }
 861  
 862      ===Returns `true` if this number is less than or equal to the given number.===
 863      @priority(9)
 864      function <=(other:UInt8):Bit {
 865          return value->builtin_int64 <= other.value->builtin_int64
 866      }
 867  
 868      ===Returns `true` if this number is less than or equal to the given number.===
 869      @priority(11)
 870      function <=(other:UInt16):Bit {
 871          return value->builtin_int64 <= other.value->builtin_int64
 872      }
 873  
 874      ===Returns `true` if this number is less than or equal to the given number.===
 875      @priority(13)
 876      function <=(other:UInt32):Bit {
 877          return value->builtin_int64 <= other.value->builtin_int64
 878      }
 879  
 880      ===Returns `true` if this number is less than or equal to the given number.===
 881      @priority(17)
 882      function <=(other:UInt):Bit {
 883          return value->builtin_int64 <= other.value->builtin_int64
 884      }
 885      ===Returns a list of all integers in the given range. The list is 'lazy', meaning that it does not actually allocate memory to hold the entire list.===
 886      @class
 887      function [](range:Range<Int>):ListView<Int> {
 888          return org.frostlang.frost.IntList(SteppedRange<Int, Int>(range.min, range.max, 1, range.inclusive))
 889      }
 890      ===Returns a list of all integers in the given stepped range. The list is 'lazy', meaning that it does not actually allocate memory to hold the entire list.===
 891      @class
 892      function [](range:SteppedRange<Int, Int>):ListView<Int> {
 893          return org.frostlang.frost.IntList(range)
 894      }
 895  
 896      ===The absolute value of this number.===
 897      property abs:Int
 898      function get_abs():Int {
 899          if self < 0 {
 900              return -self
 901          }
 902          return self
 903      }
 904      ===
 905      A view of this number as a collection of bits, with `bits[0]` as the least significant bit.
 906      ===
 907      property bits:ListView<Bit>
 908      function get_bits():ListView<Bit> { return Bits(self) }
 909  
 910      ===The square root of this number.===
 911      property sqrt:Real64
 912      function get_sqrt():Real64 {
 913          return toReal64.sqrt
 914      }
 915  
 916      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 917      @priority(10)
 918      function min(other:Int8):Int {
 919          if value < other.value->< other.value->builtin_int {
 920              return value
 921          }
 922          return other.value->builtin_int
 923      }
 924  
 925      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 926      @priority(12)
 927      function min(other:Int16):Int {
 928          if value < other.value->< other.value->builtin_int {
 929              return value
 930          }
 931          return other.value->builtin_int
 932      }
 933  
 934      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 935      @priority(14)
 936      function min(other:Int32):Int32 {
 937          if value->builtin_int32 < other.value {< other.value {
 938              return value->builtin_int32
 939          }
 940          return other.value
 941      }
 942  
 943      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 944      @priority(16)
 945      function min(other:Int64):Int64 {
 946          if value->builtin_int64 < other.value {< other.value {
 947              return value->builtin_int64
 948          }
 949          return other.value
 950      }
 951  
 952      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 953      @priority(20)
 954      function min(other:Int):Int {
 955          if value < other.value {< other.value {
 956              return value
 957          }
 958          return other.value
 959      }
 960  
 961      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 962      @priority(9)
 963      function min(other:UInt8):Int64 {
 964          if value->builtin_int64 < other.value->< other.value->builtin_int64 {
 965              return value->builtin_int64
 966          }
 967          return other.value->builtin_int64
 968      }
 969  
 970      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 971      @priority(11)
 972      function min(other:UInt16):Int64 {
 973          if value->builtin_int64 < other.value->< other.value->builtin_int64 {
 974              return value->builtin_int64
 975          }
 976          return other.value->builtin_int64
 977      }
 978  
 979      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 980      @priority(13)
 981      function min(other:UInt32):Int64 {
 982          if value->builtin_int64 < other.value->< other.value->builtin_int64 {
 983              return value->builtin_int64
 984          }
 985          return other.value->builtin_int64
 986      }
 987  
 988  
 989      ===Returns the smaller (closest to negative infinity) of this number and another number.===
 990      @priority(17)
 991      function min(other:UInt):Int64 {
 992          if value->builtin_int64 < other.value->< other.value->builtin_int64 {
 993              return value->builtin_int64
 994          }
 995          return other.value->builtin_int64
 996      }
 997  
 998      ===Returns the larger (closest to positive infinity) of this number and another number.===
 999      @priority(10)
1000      function max(other:Int8):Int {
1001          if value > other.value->builtin_int {
1002              return value
1003          }
1004          return other.value->builtin_int
1005      }
1006  
1007      ===Returns the larger (closest to positive infinity) of this number and another number.===
1008      @priority(12)
1009      function max(other:Int16):Int {
1010          if value > other.value->builtin_int {
1011              return value
1012          }
1013          return other.value->builtin_int
1014      }
1015  
1016      ===Returns the larger (closest to positive infinity) of this number and another number.===
1017      @priority(14)
1018      function max(other:Int32):Int32 {
1019          if value->builtin_int32 > other.value {
1020              return value->builtin_int32
1021          }
1022          return other.value
1023      }
1024  
1025      ===Returns the larger (closest to positive infinity) of this number and another number.===
1026      @priority(16)
1027      function max(other:Int64):Int64 {
1028          if value->builtin_int64 > other.value {
1029              return value->builtin_int64
1030          }
1031          return other.value
1032      }
1033  
1034      ===Returns the larger (closest to positive infinity) of this number and another number.===
1035      @priority(20)
1036      function max(other:Int):Int {
1037          if value > other.value {
1038              return value
1039          }
1040          return other.value
1041      }
1042  
1043      ===Returns the larger (closest to positive infinity) of this number and another number.===
1044      @priority(9)
1045      function max(other:UInt8):Int64 {
1046          if value->builtin_int64 > other.value->builtin_int64 {
1047              return value->builtin_int64
1048          }
1049          return other.value->builtin_int64
1050      }
1051  
1052      ===Returns the larger (closest to positive infinity) of this number and another number.===
1053      @priority(11)
1054      function max(other:UInt16):Int64 {
1055          if value->builtin_int64 > other.value->builtin_int64 {
1056              return value->builtin_int64
1057          }
1058          return other.value->builtin_int64
1059      }
1060  
1061      ===Returns the larger (closest to positive infinity) of this number and another number.===
1062      @priority(13)
1063      function max(other:UInt32):Int64 {
1064          if value->builtin_int64 > other.value->builtin_int64 {
1065              return value->builtin_int64
1066          }
1067          return other.value->builtin_int64
1068      }
1069  
1070  
1071      ===Returns the larger (closest to positive infinity) of this number and another number.===
1072      @priority(17)
1073      function max(other:UInt):Int64 {
1074          if value->builtin_int64 > other.value->builtin_int64 {
1075              return value->builtin_int64
1076          }
1077          return other.value->builtin_int64
1078      }
1079  
1080      @override
1081      function get_hash():Int {
1082          return Int(value)
1083      }
1084  
1085      ===The number of `1` bits in this number's binary representation.===
1086      property bitCount:Int
1087      @external(frostInt_get_bitCount)
1088      function get_bitCount():Int
1089  
1090      ===Parses a string as a number in the specified radix. Returns `null` if the parse fails.===
1091      @class
1092      @pre(radix >= 2 & radix <= 36)
1093      function parse(str:String, radix:Int):Int? {
1094          if str.startsWith("-") {
1095              def abs := Frost.parse(str[1..], radix)
1096              if abs == null {
1097                  return null
1098              }
1099              return -(abs.asInt)
1100          }
1101          else {
1102              def result := Frost.parse(str, radix)
1103              if result == null {
1104                  return null
1105              }
1106              return result.asInt
1107          }
1108      }
1109  
1110      ===
1111      This number converted to an 8 bit signed number.
1112      If this number is not in the range of an 8 bit signed number, a safety violation occurs.
1113      ===
1114      property asInt8:Int8
1115      function get_asInt8():Int8 {
1116      assert self >= Int8.MIN.toInt & self <= Int8.MAX.toInt, "Int(\{self}) cannot be safely converted to Int8"
1117          return Int8(value->builtin_int8)
1118      }
1119  
1120      ===
1121      This number converted to an 8 bit signed number.
1122      This function never fails, even if the number is not in the range of an 8 bit signed number.
1123      ===
1124      property toInt8:Int8
1125      function get_toInt8():Int8 {
1126          return Int8(value->builtin_int8)
1127      }
1128  
1129      ===
1130      This number converted to a 16 bit signed number.
1131      If this number is not in the range of a 16 bit signed number, a safety violation occurs.
1132      ===
1133      property asInt16:Int16
1134      function get_asInt16():Int16 {
1135      assert self >= Int16.MIN.toInt & self <= Int16.MAX.toInt, "Int(\{self}) cannot be safely converted to Int16"
1136          return Int16(value->builtin_int16)
1137      }
1138  
1139      ===
1140      This number converted to a 16 bit signed number.
1141      This function never fails, even if the number is not in the range of a 16 bit signed number.
1142      ===
1143      property toInt16:Int16
1144      function get_toInt16():Int16 {
1145          return Int16(value->builtin_int16)
1146      }
1147  
1148      ===
1149      This number converted to a 32 bit signed number.
1150      If this number is not in the range of a 32 bit signed number, a safety violation occurs.
1151      ===
1152      property asInt32:Int32
1153      function get_asInt32():Int32 {
1154      assert self >= Int32.MIN.toInt & self <= Int32.MAX.toInt, "Int(\{self}) cannot be safely converted to Int32"
1155          return Int32(value->builtin_int32)
1156      }
1157  
1158      ===
1159      This number converted to a 32 bit signed number.
1160      This function never fails, even if the number is not in the range of a 32 bit signed number.
1161      ===
1162      property toInt32:Int32
1163      function get_toInt32():Int32 {
1164          return Int32(value->builtin_int32)
1165      }
1166  
1167      ===
1168      This number converted to a 64 bit signed number.
1169      ===
1170      property asInt64:Int64
1171      function get_asInt64():Int64 {
1172          return Int64(value->builtin_int64)
1173      }
1174  
1175      ===
1176      This number converted to a 64 bit signed number.
1177      ===
1178      property toInt64:Int64
1179      function get_toInt64():Int64 {
1180          return Int64(value->builtin_int64)
1181      }
1182  
1183      ===
1184      This number converted to a UInt.
1185      If this number is not in the range of a UInt, a safety violation occurs.
1186      ===
1187      property asUInt:UInt
1188      function get_asUInt():UInt {
1189      assert self >= UInt.MIN.toInt, "Int(\{self}) cannot be safely converted to UInt"
1190          return UInt(value->builtin_uint)
1191      }
1192  
1193      ===
1194      This number converted to a UInt.
1195      This function never fails, even if the number is not in the range of a UInt.
1196      ===
1197      property toUInt:UInt
1198      function get_toUInt():UInt {
1199          return UInt(value->builtin_uint)
1200      }
1201  
1202      ===
1203      This number converted to an 8 bit unsigned number.
1204      If this number is not in the range of an 8 bit unsigned number, a safety violation occurs.
1205      ===
1206      property asUInt8:UInt8
1207      function get_asUInt8():UInt8 {
1208      assert self >= UInt8.MIN.toInt & self <= UInt8.MAX.toInt, "Int(\{self}) cannot be safely converted to UInt8"
1209          return UInt8(value->builtin_uint8)
1210      }
1211  
1212      ===
1213      This number converted to an 8 bit unsigned number.
1214      This function never fails, even if the number is not in the range of an 8 bit unsigned number.
1215      ===
1216      property toUInt8:UInt8
1217      function get_toUInt8():UInt8 {
1218          return UInt8(value->builtin_uint8)
1219      }
1220  
1221      ===
1222      This number converted to a 16 bit unsigned number.
1223      If this number is not in the range of a 16 bit unsigned number, a safety violation occurs.
1224      ===
1225      property asUInt16:UInt16
1226      function get_asUInt16():UInt16 {
1227      assert self >= UInt16.MIN.toInt & self <= UInt16.MAX.toInt, "Int(\{self}) cannot be safely converted to UInt16"
1228          return UInt16(value->builtin_uint16)
1229      }
1230  
1231      ===
1232      This number converted to a 16 bit unsigned number.
1233      This function never fails, even if the number is not in the range of a 16 bit unsigned number.
1234      ===
1235      property toUInt16:UInt16
1236      function get_toUInt16():UInt16 {
1237          return UInt16(value->builtin_uint16)
1238      }
1239  
1240      ===
1241      This number converted to a 32 bit unsigned number.
1242      If this number is not in the range of a 32 bit unsigned number, a safety violation occurs.
1243      ===
1244      property asUInt32:UInt32
1245      function get_asUInt32():UInt32 {
1246      assert self >= UInt32.MIN.toInt & self.toUInt64 <= UInt32.MAX.toUInt64, "Int(\{self}) cannot be safely converted to UInt32"
1247          return UInt32(value->builtin_uint32)
1248      }
1249  
1250      ===
1251      This number converted to a 32 bit unsigned number.
1252      This function never fails, even if the number is not in the range of a 32 bit unsigned number.
1253      ===
1254      property toUInt32:UInt32
1255      function get_toUInt32():UInt32 {
1256          return UInt32(value->builtin_uint32)
1257      }
1258  
1259      ===
1260      This number converted to a 64 bit unsigned number.
1261      If this number is not in the range of a 64 bit unsigned number, a safety violation occurs.
1262      ===
1263      property asUInt64:UInt64
1264      function get_asUInt64():UInt64 {
1265      assert self >= UInt64.MIN.toInt, "Int(\{self}) cannot be safely converted to UInt64"
1266          return UInt64(value->builtin_uint64)
1267      }
1268  
1269      ===
1270      This number converted to a 64 bit unsigned number.
1271      This function never fails, even if the number is not in the range of a 64 bit unsigned number.
1272      ===
1273      property toUInt64:UInt64
1274      function get_toUInt64():UInt64 {
1275          return UInt64(value->builtin_uint64)
1276      }
1277  
1278      ===
1279      This number converted to a 32 bit floating point number.
1280      ===
1281      property asReal32:Real32
1282      function get_asReal32():Real32 {
1283          return Real32(value->builtin_float32)
1284      }
1285  
1286      ===
1287      This number converted to a 32 bit floating point number.
1288      ===
1289      property toReal32:Real32
1290      function get_toReal32():Real32 {
1291          return Real32(value->builtin_float32)
1292      }
1293  
1294      ===
1295      This number converted to a 64 bit floating point number.
1296      ===
1297      property asReal64:Real64
1298      function get_asReal64():Real64 {
1299          return Real64(value->builtin_float64)
1300      }
1301  
1302      ===
1303      This number converted to a 64 bit floating point number.
1304      ===
1305      property toReal64:Real64
1306      function get_toReal64():Real64 {
1307          return Real64(value->builtin_float64)
1308      }
1309  
1310      ===Returns this number converted to a decimal string.===
1311      @override
1312      function get_toString():String {
1313          constant max := 20
1314          def chars := Pointer<Char8>.alloc(max)
1315          var index := max - 1
1316          var value := self
1317          if value >= 0 {
1318              do {
1319                  chars[index] := Char8((value % 10 + 48).asUInt8)
1320                  value := (value // 10)
1321                  index -= 1
1322              }
1323              while value > 0
1324              index += 1
1325          }
1326          else {
1327              do {
1328                  chars[index] := Char8((48 - value % 10).asUInt8)
1329                  value := (value // 10)
1330                  index -= 1
1331              }
1332              while value < 0< 0
1333              chars[index] := "-"
1334          }
1335          def size := max - index
1336          for i in 0 .. size {
1337              chars[i] := chars[i + index]
1338          }
1339          return String(chars, size)
1340      }
1341  
1342      === Returns a formatted representation of this number. Supported format strings are `""`, `"d"`, or `"D"` for decimal, `"b"` or `"B"` for binary, `"o"` or `"O"` for octal, `"x"` for lowercase hexadecimal, and `"X"` for uppercase hexadecimal. ===
1343      @override
1344      function format(fmt:String):String {
1345          return Frost.format(value < 0< 0, abs.toUInt64, 0xFFFFFFFFFFFFFFFF, fmt)
1346      }
1347  }
1348