We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
bitReverse
1 parent 833fea2 commit c7d00e0Copy full SHA for c7d00e0
src/peripherals/pio.ts
@@ -81,11 +81,11 @@ export enum WaitType {
81
}
82
83
function bitReverse(x: number) {
84
- x = ((x & 0x55555555) << 1) | ((x & 0xaaaaaaaa) >> 1);
85
- x = ((x & 0x33333333) << 2) | ((x & 0xcccccccc) >> 2);
86
- x = ((x & 0x0f0f0f0f) << 4) | ((x & 0xf0f0f0f0) >> 4);
87
- x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8);
88
- x = ((x & 0x0000ffff) << 16) | ((x & 0xffff0000) >> 16);
+ x = ((x & 0x55555555) << 1) | ((x & 0xaaaaaaaa) >>> 1);
+ x = ((x & 0x33333333) << 2) | ((x & 0xcccccccc) >>> 2);
+ x = ((x & 0x0f0f0f0f) << 4) | ((x & 0xf0f0f0f0) >>> 4);
+ x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >>> 8);
+ x = ((x & 0x0000ffff) << 16) | ((x & 0xffff0000) >>> 16);
89
return x >>> 0;
90
91
0 commit comments