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