Skip to content

Instantly share code, notes, and snippets.

@thebyrd
Created July 19, 2013 20:56
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thebyrd/6042269 to your computer and use it in GitHub Desktop.
Save thebyrd/6042269 to your computer and use it in GitHub Desktop.
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}
@fat
Copy link

fat commented Jul 19, 2013

wavvvy

@bloodyowl
Copy link

I think this can be simplified with :

function increment(i){
  return arguments[arguments.callee.length &~ 
    arguments.callee.length] & arguments.callee.length ? 
    arguments.callee(
      arguments[arguments.callee.length &~ arguments.callee.length] >> 
        arguments.callee.length
    ) << arguments.callee.length :
    arguments[arguments.callee.length &~ arguments.callee.length] | arguments.callee.length 
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment