Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created June 10, 2010 13:18
Show Gist options
  • Save swannodette/432975 to your computer and use it in GitHub Desktop.
Save swannodette/432975 to your computer and use it in GitHub Desktop.
(defn ^:static sum-8-neighbors ^long [dv ^long i ^long j ^long ncols]
(let [dv (longs dv)
v (longs (let [v1631 (longs (make-array Long/TYPE 8))]
(aset v1631 0 (aget dv (+ (* (dec i) ncols) (dec j))))
(aset v1631 1 (aget dv (+ (* (dec i) ncols) j)))
(aset v1631 2 (aget dv (+ (* (dec i) ncols) (inc j))))
(aset v1631 3 (aget dv (+ (* i ncols) (inc j))))
(aset v1631 4 (aget dv (+ (* (inc i) ncols) (inc j))))
(aset v1631 5 (aget dv (+ (* (inc i) ncols) j)))
(aset v1631 6 (aget dv (+ (* (inc i) ncols) (dec j))))
(aset v1631 7 (aget dv (+ (* i ncols) (dec j))))
v1631))]
(areduce v i sum (int 0)
(+ sum (int (aget v i))))))
;; (class: cellular_automata_basic$sum_8_neighbors, method: invokeStatic signature: (Ljava/lang/Object;JJJ)J) Register pair 5/6 contains wrong type
;; [Thrown class java.lang.VerifyError]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment