| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of fixnum; | |
| 6 | |
| 7 /** | |
| 8 * A fixed-precision integer. | |
| 9 */ | |
| 10 abstract class intx implements Comparable { | |
| 11 | |
| 12 // Arithmetic operations. | |
| 13 intx operator +(other); | |
| 14 intx operator -(other); | |
| 15 // The unary '-' operator. Note that -MIN_VALUE will be equal | |
| 16 // to MIN_VALUE due to overflow. | |
| 17 intx operator -(); | |
| 18 intx operator *(other); | |
| 19 intx operator %(other); | |
| 20 // Truncating division. | |
| 21 intx operator ~/(other); | |
| 22 intx remainder(other); | |
| 23 | |
| 24 // Note: no / operator | |
| 25 | |
| 26 // Bit-operations. | |
| 27 intx operator &(other); | |
| 28 intx operator |(other); | |
| 29 intx operator ^(other); | |
| 30 intx operator ~(); | |
| 31 intx operator <<(int shiftAmount); | |
| 32 intx operator >>(int shiftAmount); | |
| 33 intx shiftRightUnsigned(int shiftAmount); | |
| 34 | |
| 35 // Relational operations, may be applied to intx or int. | |
| 36 int compareTo(Comparable other); | |
| 37 bool operator ==(other); | |
| 38 bool operator <(other); | |
| 39 bool operator <=(other); | |
| 40 bool operator >(other); | |
| 41 bool operator >=(other); | |
| 42 | |
| 43 // Testers. | |
| 44 bool get isEven; | |
| 45 bool get isMaxValue; | |
| 46 bool get isMinValue; | |
| 47 bool get isNegative; | |
| 48 bool get isOdd; | |
| 49 bool get isZero; | |
| 50 | |
| 51 int get hashCode; | |
| 52 | |
| 53 intx abs(); | |
| 54 | |
| 55 /** | |
| 56 * Returns the number of leading zeros in this [intx] as an [int] | |
| 57 * between 0 and 64. | |
| 58 */ | |
| 59 int numberOfLeadingZeros(); | |
| 60 | |
| 61 /** | |
| 62 * Returns the number of trailing zeros in this [intx] as an [int] | |
| 63 * between 0 and 64. | |
| 64 */ | |
| 65 int numberOfTrailingZeros(); | |
| 66 | |
| 67 /** | |
| 68 * Converts this [intx] to a [List] of [int], starting with the least | |
| 69 * significant byte. | |
| 70 */ | |
| 71 List<int> toBytes(); | |
| 72 | |
| 73 /** | |
| 74 * Converts this [intx] to an [int]. On some platforms, inputs with large | |
| 75 * absolute values (i.e., > 2^52) may lose some of their low bits. | |
| 76 */ | |
| 77 int toInt(); | |
| 78 | |
| 79 /** | |
| 80 * Converts an [intx] to 32 bits. Narrower values are sign extended and | |
| 81 * wider values have their high bits truncated. | |
| 82 */ | |
| 83 int32 toInt32(); | |
| 84 | |
| 85 /** | |
| 86 * Converts an [intx] to 64 bits. | |
| 87 */ | |
| 88 int64 toInt64(); | |
| 89 | |
| 90 /** | |
| 91 * Returns the value of this [intx] as a decimal [String]. | |
| 92 */ | |
| 93 String toString(); | |
| 94 | |
| 95 /** | |
| 96 * Returns the value of this [intx] as a hexadecimal [String]. | |
| 97 */ | |
| 98 String toHexString(); | |
| 99 | |
| 100 /** | |
| 101 * Returns the value of this [intx] as a [String] in the given radix. | |
| 102 * [radix] must be an integer between 2 and 16, inclusive. | |
| 103 */ | |
| 104 String toRadixString(int radix); | |
| 105 } | |
| OLD | NEW |