Netduino home hardware projects downloads community

Jump to content


Photo

What happened to the Bit Shift Operators?

bit shift operators vb

  • Please log in to reply
10 replies to this topic

#1 clefranc

clefranc

    Member

  • Members
  • PipPip
  • 16 posts

Posted 07 March 2013 - 09:47 PM

What happened to the Bit Shift Operators in VB?

 

<<

>>

 

These operators works in C#, but I can't use them in VB?

 

EDIT#1: I'm using N+2 4.3

 

EDIT#2: You can use multiply and divide for the bit shift like this

 

UShort * 2^8 for left shifting 8 bit (<< 8)

UShort / 2^8 for right shifting 8 bit (>> 8)



#2 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 08 March 2013 - 10:10 AM

Ridiculous as bit shifting is no longer supported. Then it is houtje touwtje Visual Basic.



#3 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 08 March 2013 - 02:05 PM

Have those ever been available in VB?

 

In C# I sometimes miss the ROL and ROR from assembler.

 

Btw, is there a way to do bitwise INV, OR and AND in VB?

// C# to mask off bit 7 from variable aa &= ~0x80; 

What does "houtje touwtje" mean, is it dutch for "humty dumty"?



#4 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 08 March 2013 - 06:27 PM

Yes, and they are still there in 4.2.

 

Dim MyInteger As Integer = 12345678Dim final As IntegerDim Shifted As IntegerShifted = MyInteger << 4final = Shifted >> 4 '------> 12345678final <<= 4final >>= 4 ' -------> 12345678Dim x As Integerx = 3 And 5 ' -------> 1x = 5 Or 3  ' -------> 7

 



#5 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 09 March 2013 - 01:38 AM

Oh nice, I wasn't aware of that

#6 Woodlands-Glen

Woodlands-Glen

    Member

  • Members
  • PipPip
  • 16 posts

Posted 27 January 2014 - 10:36 PM

VB has bit shift capabilities.  Will they be put back in?  I have read in other posts that it is not in 4.2 and VS 2012 and I am using 4.3 experimental with VS2013 and it still isn't there.

 

Glen



#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 31 January 2014 - 03:44 AM

Hi Glen, Can you please file a bug report on this over at netmf.codeplex.com? I'm not sure if bit-shifting is part of VBCore or not, but if it is then this sounds like a compiler issue. In the meantime...can you use multiplication and division instead in your application? For instance, multiply your value by "2 to the power of x" instead of bit-shifting left by x. Chris

#8 Woodlands-Glen

Woodlands-Glen

    Member

  • Members
  • PipPip
  • 16 posts

Posted 01 February 2014 - 07:14 PM

Chris,

 

I put an issue in on the codeplex site.  Hopefully the bit shift operators will be put back in.

 

Glen



#9 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 02 February 2014 - 06:06 PM

Not sure it helps, but I am using a Netduino 1 running 4.2 and VS2010 and I am using bit shifter operators in my VB code without any issue.



#10 Woodlands-Glen

Woodlands-Glen

    Member

  • Members
  • PipPip
  • 16 posts

Posted 03 February 2014 - 04:06 PM

It appears to be something with 4.3.



#11 boklu

boklu

    New Member

  • Members
  • Pip
  • 1 posts

Posted 31 March 2014 - 08:33 AM

Hi,

 

i just have the same problem with the bit shifting! Are there a sulotion now?

 

boris






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.