@@ -98,7 +98,7 @@ extension type const Int16._(int _) implements int {
9898 static bool isValid (int v) => v >= minInt && v <= maxInt;
9999
100100 /// Returns [value] if its in a valid range for Int16.
101- static Int16 checkRange (int value) {
101+ factory Int16 . checkRange (int value) {
102102 RangeError .checkValueInInterval (value, minInt, maxInt, 'value' );
103103 return Int16 .fromUnchecked (value);
104104 }
@@ -335,13 +335,18 @@ extension type const Int16._(int _) implements int {
335335 }
336336
337337 /// Returns whether the n-th bit is set.
338- bool nthBit (int n) => _ .nthBit (n);
338+ bool nthBit (int n) => _descriptor .nthBit (_, n);
339339
340340 /// Returns whether the n-th bit is set.
341341 ///
342342 /// This is an alias for [nthBit] .
343343 bool operator [](int n) => nthBit (n);
344344
345+ /// Returns whether the least significant bit is set.
346+ ///
347+ /// This is equivalent to `nthBit(0)` .
348+ bool get lsb => nthBit (0 );
349+
345350 /// Returns whether the most significant bit is set.
346351 ///
347352 /// This is equivalent to `nthBit(width - 1)` .
@@ -399,7 +404,9 @@ extension type const Int16._(int _) implements int {
399404 /// ```dart
400405 /// Int16(3).nextPowerOf2(); // 4
401406 /// ```
402- Int16 nextPowerOf2 () => Int16 (_.nextPowerOf2 ());
407+ Int16 nextPowerOf2 () {
408+ return Int16 (_descriptor.overflowingNextPowerOf2 (_));
409+ }
403410
404411 /// Returns the smallest power of two greater than or equal to `this` .
405412 ///
@@ -408,7 +415,9 @@ extension type const Int16._(int _) implements int {
408415 /// `this` must be a positive integer.
409416 ///
410417 /// If the result is out of range, the behavior is undefined.
411- Int16 uncheckedNextPowerOf2 () => Int16 .fromUnchecked (_.nextPowerOf2 ());
418+ Int16 uncheckedNextPowerOf2 () {
419+ return Int16 .fromUnchecked (_descriptor.overflowingNextPowerOf2 (_));
420+ }
412421
413422 /// Returns the smallest power of two greater than or equal to `this` .
414423 ///
@@ -428,7 +437,9 @@ extension type const Int16._(int _) implements int {
428437 /// ```dart
429438 /// Int16(3).tryNextPowerOf2(); // 4
430439 /// ```
431- Int16 ? tryNextPowerOf2 () => tryFrom (_.nextPowerOf2 ());
440+ Int16 ? tryNextPowerOf2 () {
441+ return tryFrom (_descriptor.overflowingNextPowerOf2 (_));
442+ }
432443
433444 /// Returns the smallest power of two greater than or equal to `this` .
434445 ///
@@ -448,7 +459,9 @@ extension type const Int16._(int _) implements int {
448459 /// ```dart
449460 /// Int16(3).wrappedNextPowerOf2(); // 4
450461 /// ```
451- Int16 wrappedNextPowerOf2 () => Int16 .fromWrapped (_.nextPowerOf2 ());
462+ Int16 wrappedNextPowerOf2 () {
463+ return Int16 .fromWrapped (_descriptor.overflowingNextPowerOf2 (_));
464+ }
452465
453466 /// Returns the smallest power of two greater than or equal to `this` .
454467 ///
@@ -468,7 +481,9 @@ extension type const Int16._(int _) implements int {
468481 /// ```dart
469482 /// Int16(3).clampedNextPowerOf2(); // 4
470483 /// ```
471- Int16 clampedNextPowerOf2 () => Int16 .fromClamped (_.nextPowerOf2 ());
484+ Int16 clampedNextPowerOf2 () {
485+ return Int16 .fromClamped (_descriptor.overflowingNextPowerOf2 (_));
486+ }
472487
473488 /// Calculates the smallest value greater than or equal to `this` that is
474489 /// a multiple of [n] .
@@ -488,7 +503,9 @@ extension type const Int16._(int _) implements int {
488503 /// ```dart
489504 /// Int16(3).nextMultipleOf(2); // 4
490505 /// ```
491- Int16 nextMultipleOf (Int16 n) => Int16 (_.nextMultipleOf (n._));
506+ Int16 nextMultipleOf (Int16 n) {
507+ return Int16 (_descriptor.overflowingNextMultipleOf (_, n));
508+ }
492509
493510 /// Calculates the smallest value greater than or equal to `this` that is
494511 ///
@@ -498,7 +515,7 @@ extension type const Int16._(int _) implements int {
498515 ///
499516 /// If the result is out of range, the behavior is undefined.
500517 Int16 uncheckedNextMultipleOf (Int16 n) {
501- return Int16 .fromUnchecked (_. nextMultipleOf (n._ ));
518+ return Int16 .fromUnchecked (_descriptor. overflowingNextMultipleOf (_, n ));
502519 }
503520
504521 /// Calculates the smallest value greater than or equal to `this` that is
@@ -519,7 +536,9 @@ extension type const Int16._(int _) implements int {
519536 /// ```dart
520537 /// Int16(3).tryNextMultipleOf(2); // 4
521538 /// ```
522- Int16 ? tryNextMultipleOf (Int16 n) => tryFrom (_.nextMultipleOf (n._));
539+ Int16 ? tryNextMultipleOf (Int16 n) {
540+ return tryFrom (_descriptor.overflowingNextMultipleOf (_, n));
541+ }
523542
524543 /// Calculates the smallest value greater than or equal to `this` that is
525544 /// a multiple of [n] .
@@ -540,7 +559,7 @@ extension type const Int16._(int _) implements int {
540559 /// Int16(3).wrappedNextMultipleOf(2); // 4
541560 /// ```
542561 Int16 wrappedNextMultipleOf (Int16 n) {
543- return Int16 .fromWrapped (_. nextMultipleOf (n._ ));
562+ return Int16 .fromWrapped (_descriptor. overflowingNextMultipleOf (_, n ));
544563 }
545564
546565 /// Calculates the smallest value greater than or equal to `this` that is
@@ -562,7 +581,7 @@ extension type const Int16._(int _) implements int {
562581 /// Int16(3).clampedNextMultipleOf(2); // 4
563582 /// ```
564583 Int16 clampedNextMultipleOf (Int16 n) {
565- return Int16 .fromClamped (_. nextMultipleOf (n._ ));
584+ return Int16 .fromClamped (_descriptor. overflowingNextMultipleOf (_, n ));
566585 }
567586
568587 /// Returns the number of `1` s in the binary representation of `this` .
0 commit comments