Skip to content

Commit

Permalink
Correct size-t,ptr-t,offset-t types
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Mar 22, 2021
1 parent dbb62e7 commit 55294d5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/tech/v3/datatype/ffi/size_t.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@


(defn size-t-type
"the size-t datatype - either `:uint32` or `:uint64`."
[]
(if (= (size-t-size) 8)
:uint64
:uint32))


(defn offset-t-type
"the size-t datatype - either `:int32` or `:int64`."
[]
(if (= (size-t-size) 8)
Expand All @@ -47,18 +55,18 @@


(defn ptr-t-type
"the size-t datatype - either `:uint32` or `:int64`."
"the size-t datatype - either `:uint32` or `:uint64`."
[]
(if (= (size-t-size) 8)
:int64
:uint64
:uint32))


(defn ^:no-doc lower-type
"Downcast `:size-t` to its integer equivalent."
"Downcast `:size-t` to its signed integer equivalent."
[argtype]
(case argtype
:size-t (size-t-type)
:size-t (offset-t-type)
:string :pointer
argtype))

Expand All @@ -67,5 +75,5 @@
"Downcast size-t and pointers to their integer equivalents"
[argtype]
(if (#{:size-t :string :pointer} argtype)
(size-t-type)
(offset-t-type)
argtype))

0 comments on commit 55294d5

Please sign in to comment.