Skip to content

Commit

Permalink
add min and max value for int16 and uint16
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-zh authored and peter-jerry-ye committed Jan 26, 2025
1 parent 9e073ba commit c073535
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions int16/int16.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

///|
pub let max_value : Int16 = 32767

///|
pub let min_value : Int16 = -32768

///|
pub fn op_add(self : Int16, that : Int16) -> Int16 {
(self.to_int() + that.to_int()).to_int16()
Expand Down
3 changes: 3 additions & 0 deletions int16/int16.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package moonbitlang/core/int16

// Values
let max_value : Int16

let min_value : Int16

// Types and methods
impl Int16 {
Expand Down
6 changes: 6 additions & 0 deletions uint16/uint16.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

///|
pub let max_value : UInt16 = 65535

///|
pub let min_value : UInt16 = 0

///|
pub fn op_add(self : UInt16, that : UInt16) -> UInt16 {
(self.to_int() + that.to_int()).to_uint16()
Expand Down
3 changes: 3 additions & 0 deletions uint16/uint16.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package moonbitlang/core/uint16

// Values
let max_value : UInt16

let min_value : UInt16

// Types and methods
impl UInt16 {
Expand Down

0 comments on commit c073535

Please sign in to comment.