Skip to content

Instantly share code, notes, and snippets.

@trullock
Created August 9, 2012 08:49
Show Gist options
  • Save trullock/3302433 to your computer and use it in GitHub Desktop.
Save trullock/3302433 to your computer and use it in GitHub Desktop.
var result = 0;
for(var i = 0; i < a.length; i++){
var currentResult = ((a[i] > b[i]) ? 1 : (a[i] < b[i]) ? -1 : 0 );
currentResult = currentResult << (a.length - i);
result |= currentResult;
}
return result * sortDir;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment