Skip to content

Instantly share code, notes, and snippets.

@TylorS
Created May 27, 2017 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TylorS/85dcebd965f717cf592eedf3cb5d2932 to your computer and use it in GitHub Desktop.
Save TylorS/85dcebd965f717cf592eedf3cb5d2932 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
console.clear()
function swapLowAndHighBits(x: number, k: number): number {
return (x << k) | (x >> (32 - k))
}
const log = (x, k) => console.log(swapLowAndHighBits(x, k))
log(0, 10)
log(100, 5)
log(1000, 20)
log(1, 10)
{
"name": "esnextbin-sketch",
"version": "0.0.0"
}
"use strict";
console.clear();
function swapLowAndHighBits(x, k) {
return x << k | x >> 32 - k;
}
var log = function log(x, k) {
return console.log(swapLowAndHighBits(x, k));
};
log(0, 10);
log(100, 5);
log(1000, 20);
log(1, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment