OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of fixnum; | 5 part of fixnum; |
6 | 6 |
7 /** | 7 /** |
8 * A fixed-precision integer. | 8 * A fixed-precision integer. |
9 */ | 9 */ |
10 abstract class IntX implements Comparable { | 10 abstract class IntX implements Comparable { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 /** Returns `true` if and only if this integer is zero. */ | 124 /** Returns `true` if and only if this integer is zero. */ |
125 bool get isZero; | 125 bool get isZero; |
126 | 126 |
127 int get hashCode; | 127 int get hashCode; |
128 | 128 |
129 /** Returns the absolute value of this integer. */ | 129 /** Returns the absolute value of this integer. */ |
130 IntX abs(); | 130 IntX abs(); |
131 | 131 |
132 /** Clamps this integer to be in the range [lowerLimit] - [upperLimit]. */ | 132 /** Clamps this integer to be in the range [lowerLimit] - [upperLimit]. */ |
133 IntX clamp(IntX lowerLimit, IntX upperLimit); | 133 IntX clamp(lowerLimit, upperLimit); |
134 | 134 |
135 /** | 135 /** |
136 * Returns the minimum number of bits required to store this integer. | 136 * Returns the minimum number of bits required to store this integer. |
137 * | 137 * |
138 * The number of bits excludes the sign bit, which gives the natural length | 138 * The number of bits excludes the sign bit, which gives the natural length |
139 * for non-negative (unsigned) values. Negative values are complemented to | 139 * for non-negative (unsigned) values. Negative values are complemented to |
140 * return the bit position of the first bit that differs from the sign bit. | 140 * return the bit position of the first bit that differs from the sign bit. |
141 * | 141 * |
142 * To find the the number of bits needed to store the value as a signed value, | 142 * To find the the number of bits needed to store the value as a signed value, |
143 * add one, i.e. use `x.bitLength + 1`. | 143 * add one, i.e. use `x.bitLength + 1`. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 */ | 228 */ |
229 String toHexString(); | 229 String toHexString(); |
230 | 230 |
231 /** | 231 /** |
232 * Returns a string representing the value of this integer in the given radix. | 232 * Returns a string representing the value of this integer in the given radix. |
233 * | 233 * |
234 * [radix] must be an integer in the range 2 .. 16, inclusive. | 234 * [radix] must be an integer in the range 2 .. 16, inclusive. |
235 */ | 235 */ |
236 String toRadixString(int radix); | 236 String toRadixString(int radix); |
237 } | 237 } |
OLD | NEW |