Commits

Karsten Schmidt  committed 1c4f287

adding :final-type option to execute-pipeline to create view of result buffer (only useful when result buffer is byte buffer)

  • Participants
  • Parent commits 2de51b7
  • Branches develop

Comments (0)

Files changed (1)

File src/simplecl/ops.clj

       :verbose - pprint compiled queue and execution time (default false)
       :release - automatic release of all buffers (default true)"
   [{:keys [queue buffers final-out final-size]} &
-   {:keys [final-size verbose release] :or {release true}}]
+   {:keys [final-size final-type verbose release] :or {release true}}]
   (if verbose
     (do (pprint queue) (time (apply cl/enqueue queue)))
     (apply cl/enqueue queue))
   (if final-out
     (let [^Buffer nb (cl/nio-buffer final-out)
+          nb (condp = final-type
+               :int (.asIntBuffer nb)
+               :float (.asFloatBuffer nb)
+               :double (.asDoubleBuffer nb)
+               nb)
           final-size (or final-size (.capacity nb))
           ^Buffer result (cl/slice nb final-size)]
       (when release (apply cl/release buffers))