Skip to content

Commit

Permalink
various unsigned byte bugfixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Sep 12, 2019
1 parent 11b6fa8 commit 82f6781
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tech/v2/datatype/casting.clj
Expand Up @@ -290,7 +290,7 @@
"Get a jvm datatype wide enough to store all values of this datatype"
[dtype]
(case dtype
:uint8 :int32
:uint8 :int16
:uint16 :int32
:uint32 :int64
:uint64 :int64
Expand Down
3 changes: 2 additions & 1 deletion src/tech/v2/datatype/typed_buffer.clj
Expand Up @@ -70,7 +70,8 @@

dtype-proto/PToArray
(->sub-array [item]
(dtype-proto/->sub-array backing-store))
(when (= datatype (dtype-proto/get-datatype backing-store))
(dtype-proto/->sub-array backing-store)))
(->array-copy [item]
(if (= datatype (dtype-proto/get-datatype backing-store))
(dtype-proto/->array-copy backing-store)
Expand Down
8 changes: 8 additions & 0 deletions test/tech/v2/datatype_test.clj
Expand Up @@ -302,3 +302,11 @@
(is (= (vec (range 200 255))
(-> (dtype/make-container :list :uint8 (range 200 255))
dtype/->vector))))


(deftest desc-stats-unsigned-types
(is (= {:min 0.0
:max 255.0}
(-> (dtype/make-container :typed-buffer :uint8 (range 256))
(dfn/descriptive-stats)
(select-keys [:min :max])))))

0 comments on commit 82f6781

Please sign in to comment.