Skip to content

Commit c073535

Browse files
Yu-zhpeter-jerry-ye
authored andcommitted
add min and max value for int16 and uint16
1 parent 9e073ba commit c073535

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

int16/int16.mbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
///|
16+
pub let max_value : Int16 = 32767
17+
18+
///|
19+
pub let min_value : Int16 = -32768
20+
1521
///|
1622
pub fn op_add(self : Int16, that : Int16) -> Int16 {
1723
(self.to_int() + that.to_int()).to_int16()

int16/int16.mbti

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package moonbitlang/core/int16
22

33
// Values
4+
let max_value : Int16
5+
6+
let min_value : Int16
47

58
// Types and methods
69
impl Int16 {

uint16/uint16.mbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
///|
16+
pub let max_value : UInt16 = 65535
17+
18+
///|
19+
pub let min_value : UInt16 = 0
20+
1521
///|
1622
pub fn op_add(self : UInt16, that : UInt16) -> UInt16 {
1723
(self.to_int() + that.to_int()).to_uint16()

uint16/uint16.mbti

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package moonbitlang/core/uint16
22

33
// Values
4+
let max_value : UInt16
5+
6+
let min_value : UInt16
47

58
// Types and methods
69
impl UInt16 {

0 commit comments

Comments
 (0)