Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
ocaml source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
x86-64 ocamlopt 4.04.2
x86-64 ocamlopt 4.06.1
x86-64 ocamlopt 4.07.1
x86-64 ocamlopt 4.07.1-flambda
x86-64 ocamlopt 4.08.1
x86-64 ocamlopt 4.08.1-flambda
x86-64 ocamlopt 4.09.0
x86-64 ocamlopt 4.09.0-flambda
x86-64 ocamlopt 4.09.1
x86-64 ocamlopt 4.09.1-flambda
x86-64 ocamlopt 4.10.0
x86-64 ocamlopt 4.10.0-flambda
x86-64 ocamlopt 4.10.1
x86-64 ocamlopt 4.10.1-flambda
x86-64 ocamlopt 4.10.2
x86-64 ocamlopt 4.10.2-flambda
x86-64 ocamlopt 4.11.1
x86-64 ocamlopt 4.11.1-flambda
x86-64 ocamlopt 4.11.2
x86-64 ocamlopt 4.11.2-flambda
x86-64 ocamlopt 4.12.0
x86-64 ocamlopt 4.12.0-flambda
x86-64 ocamlopt 4.13.1
x86-64 ocamlopt 4.13.1-flambda
x86-64 ocamlopt 4.14.0
x86-64 ocamlopt 4.14.0-flambda
x86-64 ocamlopt 4.14.2
x86-64 ocamlopt 4.14.2-flambda
x86-64 ocamlopt 5.0.0
x86-64 ocamlopt 5.0.0-flambda
x86-64 ocamlopt 5.1.0
x86-64 ocamlopt 5.1.1
x86-64 ocamlopt 5.2.0
Options
Source code
type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t external bigarray_set_int64_ne : bigstring -> int -> int64 -> unit = "%caml_bigstring_set64u" type string_ref = | Ref of int | String of string module I64 = struct include Int64 let ( lsl ) = Int64.shift_left let ( lsr ) = Int64.shift_right_logical let ( lor ) = Int64.logor let ( + ) = Int64.add end let bool_into_bigstring buf ~off ~name value = match name, value with | true, Ref idx -> let open I64 in let hdr = (8L lsl 4) + 9L in let idx = (of_int idx) lsl 16 in let bol = 1L lsl 32 in bigarray_set_int64_ne buf 0 (bol lor idx lor hdr); 8 | true, String str -> let padded = ((String.length str + 7) lsr 3) lsl 3 in begin let open I64 in let hdr = (8L lsl 4) + 9L in let idx = ((of_int (String.length str)) lor 0x8000L) lsl 16 in let bol = 1L lsl 32 in bigarray_set_int64_ne buf 0 (bol lor idx lor hdr) end; 8 + padded | _ -> assert false let bool_to_string ~name value = match name, value with | true, Ref idx -> let buf = Bytes.create 8 in let open I64 in let hdr = (8L lsl 4) + 9L in let idx = (of_int idx) lsl 16 in let bol = 1L lsl 32 in Bytes.set_int64_ne buf 0 (bol lor idx lor hdr); buf | true, String str -> let padded = ((String.length str + 7) lsr 3) lsl 3 in let buf = Bytes.create 8 in begin let open I64 in let hdr = (8L lsl 4) + 9L in let idx = ((of_int (String.length str)) lor 0x8000L) lsl 16 in let bol = 1L lsl 32 in Bytes.set_int64_ne buf 0 (bol lor idx lor hdr) end; buf | _ -> assert false
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree