-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add predefined types for tagged int8 and int16 (#3347)
added predefined types for int8 and int16, along with modules for them in Stdlib_beta
- Loading branch information
Showing
31 changed files
with
1,388 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Please make a pull request to change this file. | ||
# Keep the remainder of this file in sync with other .ocamlformat files in this repo. | ||
assignment-operator=begin-line | ||
cases-exp-indent=2 | ||
doc-comments=before | ||
dock-collection-brackets=false | ||
if-then-else=keyword-first | ||
module-item-spacing=sparse | ||
parens-tuple=multi-line-only | ||
sequence-blank-line=compact | ||
space-around-lists=false | ||
space-around-variants=false | ||
type-decl=sparse | ||
wrap-comments=true | ||
version=0.24.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
stdlib_beta.mli | ||
int8.ml | ||
int8.mli | ||
int16.ml | ||
int16.mli | ||
int_wrapper.ml | ||
stdlib_beta.ml | ||
|
||
stdlib_beta.mli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jacob Van Buren, Jane Street, New York *) | ||
(* *) | ||
(* Copyright 2024 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
[@@@ocaml.flambda_o3] | ||
|
||
type t = int16 | ||
|
||
include | ||
Int_wrapper.Make | ||
(Int_wrapper) | ||
(struct | ||
type nonrec t = t | ||
|
||
let int_size = 16 | ||
|
||
external inject : t -> int = "%identity" | ||
|
||
external unchecked_project : int -> t = "%identity" | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jacob Van Buren, Jane Street, New York *) | ||
(* *) | ||
(* Copyright 2024 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
(** Signed 16-bit integer values. | ||
These integers are {16} bits wide and use two's complement representation. | ||
All operations are taken modulo 2{^16}. They do not fail on overflow. *) | ||
|
||
(** The type for 16-bit integer values. *) | ||
type t = int16 [@@immediate] | ||
|
||
(** @inline *) | ||
include Int_wrapper.S with type t := int16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jacob Van Buren, Jane Street, New York *) | ||
(* *) | ||
(* Copyright 2024 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
[@@@ocaml.flambda_o3] | ||
|
||
type t = int8 | ||
|
||
include | ||
Int_wrapper.Make | ||
(Int_wrapper) | ||
(struct | ||
type nonrec t = t | ||
|
||
let int_size = 8 | ||
|
||
external inject : t -> int = "%identity" | ||
|
||
external unchecked_project : int -> t = "%identity" | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jacob Van Buren, Jane Street, New York *) | ||
(* *) | ||
(* Copyright 2024 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
(** Signed 8-bit integer values. | ||
These integers are {8} bits wide and use two's complement representation. | ||
All operations are taken modulo 2{^8}. They do not fail on overflow. *) | ||
|
||
(** The type for 8-bit integer values. *) | ||
type t = int8 [@@immediate] | ||
|
||
(** @inline *) | ||
include Int_wrapper.S with type t := int8 |
Oops, something went wrong.