mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
cbda258fcc
This allows to import StdInt.carp by itself in --no-core situations
364 lines
11 KiB
Plaintext
364 lines
11 KiB
Plaintext
(system-include "carp_stdint.h")
|
|
|
|
(register-type Uint8)
|
|
(register-type Uint16)
|
|
(register-type Uint32)
|
|
(register-type Uint64)
|
|
(register-type Int8)
|
|
(register-type Int16)
|
|
(register-type Int32)
|
|
(register-type Int64)
|
|
|
|
(defmodule Int8
|
|
(register = (λ [Int8 Int8] Bool))
|
|
(register > (λ [Int8 Int8] Bool))
|
|
(register < (λ [Int8 Int8] Bool))
|
|
(register + (λ [Int8 Int8] Int8))
|
|
(register - (λ [Int8 Int8] Int8))
|
|
(register * (λ [Int8 Int8] Int8))
|
|
(register / (λ [Int8 Int8] Int8))
|
|
(register bit-shift-left (λ [Int8 Int8] Int8))
|
|
(register bit-shift-right (λ [Int8 Int8] Int8))
|
|
(register bit-or (λ [Int8 Int8] Int8))
|
|
(register bit-and (λ [Int8 Int8] Int8))
|
|
(register bit-not (λ [Int8] Int8))
|
|
(register bit-xor (λ [Int8 Int8] Int8))
|
|
(register to-long (λ [Int8] Long))
|
|
(register from-long (λ [Long] Int8))
|
|
(register copy (Fn [&Int8] Int8))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Int8)))
|
|
|
|
(implements + Int8.+)
|
|
(implements - Int8.-)
|
|
(implements * Int8.*)
|
|
(implements / Int8./)
|
|
(implements < Int8.<)
|
|
(implements > Int8.>)
|
|
(implements = Int8.=)
|
|
(implements copy Int8.copy)
|
|
(implements zero Int8.zero)
|
|
(implements bit-shift-left Int8.bit-shift-left)
|
|
(implements bit-shift-right Int8.bit-shift-right)
|
|
(implements bit-and Int8.bit-and)
|
|
(implements bit-or Int8.bit-or)
|
|
(implements bit-xor Int8.bit-xor)
|
|
(implements bit-not Int8.bit-not)
|
|
)
|
|
|
|
(defmodule Int8Extra
|
|
(defn = [a b] (Int8.= @a @b))
|
|
(implements = Int8Extra.=)
|
|
)
|
|
|
|
(defmodule Int16
|
|
(register = (λ [Int16 Int16] Bool))
|
|
(register > (λ [Int16 Int16] Bool))
|
|
(register < (λ [Int16 Int16] Bool))
|
|
(register + (λ [Int16 Int16] Int16))
|
|
(register - (λ [Int16 Int16] Int16))
|
|
(register * (λ [Int16 Int16] Int16))
|
|
(register / (λ [Int16 Int16] Int16))
|
|
(register bit-shift-left (λ [Int16 Int16] Int16))
|
|
(register bit-shift-right (λ [Int16 Int16] Int16))
|
|
(register bit-or (λ [Int16 Int16] Int16))
|
|
(register bit-and (λ [Int16 Int16] Int16))
|
|
(register bit-not (λ [Int16] Int16))
|
|
(register bit-xor (λ [Int16 Int16] Int16))
|
|
(register to-long (λ [Int16] Long))
|
|
(register from-long (λ [Long] Int16))
|
|
(register copy (Fn [&Int16] Int16))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Int16)))
|
|
|
|
(implements + Int16.+)
|
|
(implements - Int16.-)
|
|
(implements * Int16.*)
|
|
(implements / Int16./)
|
|
(implements < Int16.<)
|
|
(implements > Int16.>)
|
|
(implements = Int16.=)
|
|
(implements copy Int16.copy)
|
|
(implements zero Int16.zero)
|
|
(implements bit-shift-left Int16.bit-shift-left)
|
|
(implements bit-shift-right Int16.bit-shift-right)
|
|
(implements bit-and Int16.bit-and)
|
|
(implements bit-or Int16.bit-or)
|
|
(implements bit-xor Int16.bit-xor)
|
|
(implements bit-not Int16.bit-not)
|
|
)
|
|
|
|
(defmodule Int16Extra
|
|
(defn = [a b] (Int16.= @a @b))
|
|
(implements = Int16Extra.=)
|
|
)
|
|
|
|
(defmodule Int32
|
|
(register = (λ [Int32 Int32] Bool))
|
|
(register > (λ [Int32 Int32] Bool))
|
|
(register < (λ [Int32 Int32] Bool))
|
|
(register + (λ [Int32 Int32] Int32))
|
|
(register - (λ [Int32 Int32] Int32))
|
|
(register * (λ [Int32 Int32] Int32))
|
|
(register / (λ [Int32 Int32] Int32))
|
|
(register bit-shift-left (λ [Int32 Int32] Int32))
|
|
(register bit-shift-right (λ [Int32 Int32] Int32))
|
|
(register bit-or (λ [Int32 Int32] Int32))
|
|
(register bit-and (λ [Int32 Int32] Int32))
|
|
(register bit-not (λ [Int32] Int32))
|
|
(register bit-xor (λ [Int32 Int32] Int32))
|
|
(register to-long (λ [Int32] Long))
|
|
(register from-long (λ [Long] Int32))
|
|
(register copy (Fn [&Int32] Int32))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Int32)))
|
|
|
|
(implements + Int32.+)
|
|
(implements - Int32.-)
|
|
(implements * Int32.*)
|
|
(implements / Int32./)
|
|
(implements < Int32.<)
|
|
(implements > Int32.>)
|
|
(implements = Int32.=)
|
|
(implements copy Int32.copy)
|
|
(implements zero Int32.zero)
|
|
(implements bit-shift-left Int32.bit-shift-left)
|
|
(implements bit-shift-right Int32.bit-shift-right)
|
|
(implements bit-and Int32.bit-and)
|
|
(implements bit-or Int32.bit-or)
|
|
(implements bit-xor Int32.bit-xor)
|
|
(implements bit-not Int32.bit-not)
|
|
)
|
|
|
|
(defmodule Int32Extra
|
|
(defn = [a b] (Int32.= @a @b))
|
|
(implements = Int32Extra.=)
|
|
)
|
|
|
|
(defmodule Int64
|
|
(register = (λ [Int64 Int64] Bool))
|
|
(register > (λ [Int64 Int64] Bool))
|
|
(register < (λ [Int64 Int64] Bool))
|
|
(register + (λ [Int64 Int64] Int64))
|
|
(register - (λ [Int64 Int64] Int64))
|
|
(register * (λ [Int64 Int64] Int64))
|
|
(register / (λ [Int64 Int64] Int64))
|
|
(register bit-shift-left (λ [Int64 Int64] Int64))
|
|
(register bit-shift-right (λ [Int64 Int64] Int64))
|
|
(register bit-or (λ [Int64 Int64] Int64))
|
|
(register bit-and (λ [Int64 Int64] Int64))
|
|
(register bit-not (λ [Int64] Int64))
|
|
(register bit-xor (λ [Int64 Int64] Int64))
|
|
(register to-long (λ [Int64] Long))
|
|
(register from-long (λ [Long] Int64))
|
|
(register copy (Fn [&Int64] Int64))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Int64)))
|
|
|
|
(implements + Int64.+)
|
|
(implements - Int64.-)
|
|
(implements * Int64.*)
|
|
(implements / Int64./)
|
|
(implements < Int64.<)
|
|
(implements > Int64.>)
|
|
(implements = Int64.=)
|
|
(implements copy Int64.copy)
|
|
(implements zero Int64.zero)
|
|
(implements bit-shift-left Int64.bit-shift-left)
|
|
(implements bit-shift-right Int64.bit-shift-right)
|
|
(implements bit-and Int64.bit-and)
|
|
(implements bit-or Int64.bit-or)
|
|
(implements bit-xor Int64.bit-xor)
|
|
(implements bit-not Int64.bit-not)
|
|
)
|
|
|
|
(defmodule Int64Extra
|
|
(defn = [a b] (Int64.= @a @b))
|
|
(implements = Int64Extra.=)
|
|
)
|
|
|
|
(defmodule Uint8
|
|
(register = (λ [Uint8 Uint8] Bool))
|
|
(register > (λ [Uint8 Uint8] Bool))
|
|
(register < (λ [Uint8 Uint8] Bool))
|
|
(register + (λ [Uint8 Uint8] Uint8))
|
|
(register - (λ [Uint8 Uint8] Uint8))
|
|
(register * (λ [Uint8 Uint8] Uint8))
|
|
(register / (λ [Uint8 Uint8] Uint8))
|
|
(register bit-shift-left (λ [Uint8 Uint8] Uint8))
|
|
(register bit-shift-right (λ [Uint8 Uint8] Uint8))
|
|
(register bit-or (λ [Uint8 Uint8] Uint8))
|
|
(register bit-and (λ [Uint8 Uint8] Uint8))
|
|
(register bit-not (λ [Uint8] Uint8))
|
|
(register bit-xor (λ [Uint8 Uint8] Uint8))
|
|
(register to-long (λ [Uint8] Long))
|
|
(register from-long (λ [Long] Uint8))
|
|
(register copy (Fn [&Uint8] Uint8))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Uint8)))
|
|
|
|
(implements + Uint8.+)
|
|
(implements - Uint8.-)
|
|
(implements * Uint8.*)
|
|
(implements / Uint8./)
|
|
(implements < Uint8.<)
|
|
(implements > Uint8.>)
|
|
(implements = Uint8.=)
|
|
(implements copy Uint8.copy)
|
|
(implements zero Uint8.zero)
|
|
(implements bit-shift-left Uint8.bit-shift-left)
|
|
(implements bit-shift-right Uint8.bit-shift-right)
|
|
(implements bit-and Uint8.bit-and)
|
|
(implements bit-or Uint8.bit-or)
|
|
(implements bit-xor Uint8.bit-xor)
|
|
(implements bit-not Uint8.bit-not)
|
|
)
|
|
|
|
(defmodule Uint8Extra
|
|
(defn = [a b] (Uint8.= @a @b))
|
|
(implements = Uint8Extra.=)
|
|
)
|
|
|
|
(defmodule Uint16
|
|
(register = (λ [Uint16 Uint16] Bool))
|
|
(register > (λ [Uint16 Uint16] Bool))
|
|
(register < (λ [Uint16 Uint16] Bool))
|
|
(register + (λ [Uint16 Uint16] Uint16))
|
|
(register - (λ [Uint16 Uint16] Uint16))
|
|
(register * (λ [Uint16 Uint16] Uint16))
|
|
(register / (λ [Uint16 Uint16] Uint16))
|
|
(register bit-shift-left (λ [Uint16 Uint16] Uint16))
|
|
(register bit-shift-right (λ [Uint16 Uint16] Uint16))
|
|
(register bit-or (λ [Uint16 Uint16] Uint16))
|
|
(register bit-and (λ [Uint16 Uint16] Uint16))
|
|
(register bit-not (λ [Uint16] Uint16))
|
|
(register bit-xor (λ [Uint16 Uint16] Uint16))
|
|
(register to-long (λ [Uint16] Long))
|
|
(register from-long (λ [Long] Uint16))
|
|
(register copy (Fn [&Uint16] Uint16))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Uint16)))
|
|
|
|
(implements + Uint16.+)
|
|
(implements - Uint16.-)
|
|
(implements * Uint16.*)
|
|
(implements / Uint16./)
|
|
(implements < Uint16.<)
|
|
(implements > Uint16.>)
|
|
(implements = Uint16.=)
|
|
(implements copy Uint16.copy)
|
|
(implements zero Uint16.zero)
|
|
(implements bit-shift-left Uint16.bit-shift-left)
|
|
(implements bit-shift-right Uint16.bit-shift-right)
|
|
(implements bit-and Uint16.bit-and)
|
|
(implements bit-or Uint16.bit-or)
|
|
(implements bit-xor Uint16.bit-xor)
|
|
(implements bit-not Uint16.bit-not)
|
|
)
|
|
|
|
(defmodule Uint16Extra
|
|
(defn = [a b] (Uint16.= @a @b))
|
|
(implements = Uint16Extra.=)
|
|
)
|
|
|
|
(defmodule Uint32
|
|
(register = (λ [Uint32 Uint32] Bool))
|
|
(register > (λ [Uint32 Uint32] Bool))
|
|
(register < (λ [Uint32 Uint32] Bool))
|
|
(register + (λ [Uint32 Uint32] Uint32))
|
|
(register - (λ [Uint32 Uint32] Uint32))
|
|
(register * (λ [Uint32 Uint32] Uint32))
|
|
(register / (λ [Uint32 Uint32] Uint32))
|
|
(register bit-shift-left (λ [Uint32 Uint32] Uint32))
|
|
(register bit-shift-right (λ [Uint32 Uint32] Uint32))
|
|
(register bit-or (λ [Uint32 Uint32] Uint32))
|
|
(register bit-and (λ [Uint32 Uint32] Uint32))
|
|
(register bit-not (λ [Uint32] Uint32))
|
|
(register bit-xor (λ [Uint32 Uint32] Uint32))
|
|
(register to-long (λ [Uint32] Long))
|
|
(register from-long (λ [Long] Uint32))
|
|
(register copy (Fn [&Uint32] Uint32))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Uint32)))
|
|
|
|
(implements + Uint32.+)
|
|
(implements - Uint32.-)
|
|
(implements * Uint32.*)
|
|
(implements / Uint32./)
|
|
(implements < Uint32.<)
|
|
(implements > Uint32.>)
|
|
(implements = Uint32.=)
|
|
(implements copy Uint32.copy)
|
|
(implements zero Uint32.zero)
|
|
(implements bit-shift-left Uint32.bit-shift-left)
|
|
(implements bit-shift-right Uint32.bit-shift-right)
|
|
(implements bit-and Uint32.bit-and)
|
|
(implements bit-or Uint32.bit-or)
|
|
(implements bit-xor Uint32.bit-xor)
|
|
(implements bit-not Uint32.bit-not)
|
|
)
|
|
|
|
(defmodule Uint32Extra
|
|
(defn = [a b] (Uint32.= @a @b))
|
|
(implements = Uint32Extra.=)
|
|
)
|
|
|
|
(defmodule Uint64
|
|
(register = (λ [Uint64 Uint64] Bool))
|
|
(register > (λ [Uint64 Uint64] Bool))
|
|
(register < (λ [Uint64 Uint64] Bool))
|
|
(register + (λ [Uint64 Uint64] Uint64))
|
|
(register - (λ [Uint64 Uint64] Uint64))
|
|
(register * (λ [Uint64 Uint64] Uint64))
|
|
(register / (λ [Uint64 Uint64] Uint64))
|
|
(register bit-shift-left (λ [Uint64 Uint64] Uint64))
|
|
(register bit-shift-right (λ [Uint64 Uint64] Uint64))
|
|
(register bit-or (λ [Uint64 Uint64] Uint64))
|
|
(register bit-and (λ [Uint64 Uint64] Uint64))
|
|
(register bit-not (λ [Uint64] Uint64))
|
|
(register bit-xor (λ [Uint64 Uint64] Uint64))
|
|
(register to-long (λ [Uint64] Long))
|
|
(register from-long (λ [Long] Uint64))
|
|
(register copy (Fn [&Uint64] Uint64))
|
|
|
|
(defn zero [] (from-long 0l))
|
|
|
|
(register from-bytes (Fn [&(Array Byte)] (Array Uint64)))
|
|
|
|
(implements + Uint64.+)
|
|
(implements - Uint64.-)
|
|
(implements * Uint64.*)
|
|
(implements / Uint64./)
|
|
(implements < Uint64.<)
|
|
(implements > Uint64.>)
|
|
(implements = Uint64.=)
|
|
(implements copy Uint64.copy)
|
|
(implements zero Uint64.zero)
|
|
(implements bit-shift-left Uint64.bit-shift-left)
|
|
(implements bit-shift-right Uint64.bit-shift-right)
|
|
(implements bit-and Uint64.bit-and)
|
|
(implements bit-or Uint64.bit-or)
|
|
(implements bit-xor Uint64.bit-xor)
|
|
(implements bit-not Uint64.bit-not)
|
|
)
|
|
|
|
(defmodule Uint64Extra
|
|
(defn = [a b] (Uint64.= @a @b))
|
|
(implements = Uint64Extra.=)
|
|
)
|
|
|