Skip to content

Commit

Permalink
Fixing double array set constant code.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Oct 9, 2021
1 parent 8f2e0f6 commit 70d6e07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tech/v3/datatype/array_buffer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
:int64 (Arrays/fill ^longs ary-data offset end-offset (unchecked-long value))
:float32 (Arrays/fill ^floats ary-data offset
end-offset (unchecked-float value))
:float64 (Arrays/fill ^longs ary-data offset end-offset (unchecked-long value))
:float64 (Arrays/fill ^doubles ary-data offset end-offset (unchecked-double value))

This comment has been minimized.

Copy link
@harold

harold Oct 9, 2021

Collaborator

👀 - I see!

:^)

(Arrays/fill ^"[Ljava.lang.Object;" ary-data offset end-offset value))))
dtype-proto/PClone
(clone [this]
Expand Down
15 changes: 15 additions & 0 deletions test/tech/v3/datatype_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,18 @@

(deftest ->reader-bad-dtype
(is (thrown? Throwable (dtype/->reader [1 2 3] :foo))))


(deftest set-constant-all-numeric-dtypes
(let [dtypes [:int8 :uint8
:int16 :uin16
:int32 :uint32
:int64 :uint64
:float32 :float64]
containers [:jvm-heap :native-heap]]
(for [dtype dtypes
container containers]
(let [data (dtype/make-container container dtype 10)]
(dtype/set-constant! data 1)
(is (= (mapv long (dtype/->reader data))
(vec (repeat 10 1))))))))

0 comments on commit 70d6e07

Please sign in to comment.