javascript - How to apply bitwise right shift operator on binary? -


How do I change bits correctly on binary?

& gt; & Gt; applies to integers in JS, then, 6> gt; & Gt; 1 (bitwise shift correct, step 1) results 3 ( 110> 1 = 011 - true) as it shows, but it is good. Is it possible to work with the correct operator with the change in binary?

I need it: 110> & gt; 1 Working correctly, it will show 55 as the result and it is correct. 110 is 01101110. 01101110 & gt; & Gt; 1 = 00110111 . 00110111 is 55. right. But I want the result as 011 ! How can I do this in JS?

This looks like how string manipers for me:

 < Code> function shr (x, s) {new string ('0', math .min (s, x.length)) + x.substr (0, Math. (0, x long - s)); } & Gt; & Gt; & Gt; Alternatively, you can use the normal bitwire operator and convert it to string (one time) before rendering and can change back to string presentation. Later (once). 


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -