Last active
December 14, 2015 03:29
-
-
Save Idorobots/5021523 to your computer and use it in GitHub Desktop.
Simple Hillis-Steele inclusive scan algorithm implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
V hillis_steele(alias op, V)(V array) { | |
for(size_t i = 1; i < array.length; i *= 2) { | |
for(size_t j = array.length; j > 0; --j) { | |
if(j > i) { | |
array[j-1] = op(array[j-1-i], array[j-1]); | |
} | |
} | |
} | |
return array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment