bit shift - How do I translate the >>> operator in JavaScript to VB.NET? -


i doing code conversion javascript vb.net. stuck >>> operation.

see sample code , attempt below:

javascript:

function test(a, b) {     return (a << b) | (a >>> (32 - b)) } 

my attempt in vb.net:

private function test(byval integer, byval b integer) integer     return ((a << b) or (cushort(a) >> (32 - b))) end function 

what doing wrong?

you should use cuint instead of cushort.

cushort gives ushort 16-bit in size. in javascript bit operations done in 32-bit, a should converted 32-bit unsigned type — uinteger.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -