Created
January 18, 2018 04:53
-
-
Save JNaftali/19c80badd42f7d32d7169c91078f0e37 to your computer and use it in GitHub Desktop.
logical operators intended for use in gpu.js
This file contains 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
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