Change ::integer to ::int

This commit is contained in:
Joshua Suskalo 2021-09-15 12:15:24 -05:00
parent ce29d1e9ee
commit 138786b69e

View file

@ -43,7 +43,7 @@
[_] [_]
Short/SIZE) Short/SIZE)
(defmethod size-of ::integer (defmethod size-of ::int
[_] [_]
Integer/SIZE) Integer/SIZE)
@ -75,7 +75,7 @@
"Map of primitive type names to the [[CLinker]] types for a method handle." "Map of primitive type names to the [[CLinker]] types for a method handle."
{::byte CLinker/C_CHAR {::byte CLinker/C_CHAR
::short CLinker/C_SHORT ::short CLinker/C_SHORT
::integer CLinker/C_INT ::int CLinker/C_INT
::long CLinker/C_LONG ::long CLinker/C_LONG
::long-long CLinker/C_LONG_LONG ::long-long CLinker/C_LONG_LONG
::char CLinker/C_CHAR ::char CLinker/C_CHAR
@ -87,7 +87,7 @@
"Map of primitive type names to the Java types for a method handle." "Map of primitive type names to the Java types for a method handle."
{::byte Byte/TYPE {::byte Byte/TYPE
::short Short/TYPE ::short Short/TYPE
::integer Integer/TYPE ::int Integer/TYPE
::long Long/TYPE ::long Long/TYPE
::long-long Long/TYPE ::long-long Long/TYPE
::char Byte/TYPE ::char Byte/TYPE
@ -117,27 +117,27 @@
;; body ;; body
(defcfun strlen (defcfun strlen
"Counts the number of bytes in a C String." "Counts the number of bytes in a C String."
"strlen" [::c-string] ::integer) "strlen" [::c-string] ::int)
;; This function has an output parameter and requires some clojure code to ;; This function has an output parameter and requires some clojure code to
;; translate the values from the c fn to something sensible in clojure. ;; translate the values from the c fn to something sensible in clojure.
(defcfun some-func (defcfun some-func
"Gets some output value" "Gets some output value"
"someFunc" [::pointer] ::integer "someFunc" [::pointer] ::int
[] []
(let [out-int (alloc-instance ::integer) (let [out-int (alloc-instance ::int)
success? (zero? (some-func out-int))] success? (zero? (some-func (.address out-int)))]
(if success? (if success?
(deserialize ::integer out-int) (deserialize ::int out-int)
(throw (ex-info (getErrorString) {}))))) (throw (ex-info (getErrorString) {})))))
;; This function probably wouldn't actually get wrapped, since the cost of ;; This function probably wouldn't actually get wrapped, since the cost of
;; marshalling is greater than the speed boost of using an in-place sort. That ;; marshalling is greater than the speed boost of using an in-place sort. That
;; said, this is a nice sample of what more complex marshalling looks like. ;; said, this is a nice sample of what more complex marshalling looks like.
(defcfun qsort (defcfun qsort
"Quicksort implementation" "Quicksort implementation"
"qsort" "qsort"
[::pointer ::long ::long (fn [::pointer ::pointer] ::integer)] [::pointer ::long ::long (fn [::pointer ::pointer] ::int)]
::void ::void
[type comparator list] [type comparator list]
(let [copied-list (alloc (* (count list) (size-of type))) (let [copied-list (alloc (* (count list) (size-of type)))