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