made with esnextbin
Created
May 27, 2017 18:52
-
-
Save TylorS/85dcebd965f717cf592eedf3cb5d2932 to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!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> |
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
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) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0" | |
} |
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
"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