Skip to content

Instantly share code, notes, and snippets.

@JNaftali
Created January 18, 2018 04:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JNaftali/19c80badd42f7d32d7169c91078f0e37 to your computer and use it in GitHub Desktop.
Save JNaftali/19c80badd42f7d32d7169c91078f0e37 to your computer and use it in GitHub Desktop.
logical operators intended for use in gpu.js
function not(x) {
if (x) return false
return true
}
function and() {
for (var i = 0; i< arguments.length; i++) {
if ( not(arguments[i]) ) return false
}
return true
}
function or() {
for (var i = 0; i< arguments.length; i++) {
if ( arguments[i] ) return true
}
return false
}
// to use with gpu.js just use `gpu.addFunction(not)` etc with any of the ones you want to use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment