Using a CSharp to vb.net converter, I've been stuck on a single line
of code for hours
Original C# code
uint result = dcb.Flags & (mask << whichFlag);
return (int) (result >> whichFlag);
Vb.Net code
Return CInt(Machine.Sh ift.Right(resul t, whichFlag))
What is this machine.Shift thing? I understand what it is meant to do
but what namespace do I have to include to make this thing work? 3 2581
"Stephane Belzile" <st************ *@cgi.com> schrieb: Using a CSharp to vb.net converter, I've been stuck on a single line of code for hours
Original C# code
uint result = dcb.Flags & (mask << whichFlag); return (int) (result >> whichFlag);
Vb.Net code Return CInt(Machine.Sh ift.Right(resul t, whichFlag))
What is this machine.Shift thing? I understand what it is meant to do but what namespace do I have to include to make this thing work
There is no such thing. But if you are using VB.NET 2003, you can use '<<'
there too.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
> There is no such thing. But if you are using VB.NET 2003, you can use '<<' there too.
but it doesn't work for unsigned variables (API etc.)...
--
Pozdrav,
Josip Medved, MCSD http://www.jmedved.com
Stephane,
As Hefried suggests, I would use << or >> in VS.NET 2003.
As you may know unsigned integers are not supported in VS.NET 2003, VS.NET
2005 (aka Whidbey due out later in 2005) will add support for unsigned
integers. For details on VS.NET 2005 see http://lab.msdn.microsoft.com/vs2005/.
Where did you get the following sample? Return CInt(Machine.Sh ift.Right(resul t, whichFlag)) What is this machine.Shift thing? I understand what it is meant to do but what namespace do I have to include to make this thing work?
To the best of my knowledge (and a quick search of MSDN) it is not part of
the .NET framework?
Is it a private assembly required by the C# to VB.NET converter you used?
Hope this helps
Jay
"Stephane Belzile" <st************ *@cgi.com> wrote in message
news:60******** *************** ***@posting.goo gle.com... Using a CSharp to vb.net converter, I've been stuck on a single line of code for hours
Original C# code
uint result = dcb.Flags & (mask << whichFlag); return (int) (result >> whichFlag);
Vb.Net code Return CInt(Machine.Sh ift.Right(resul t, whichFlag))
What is this machine.Shift thing? I understand what it is meant to do but what namespace do I have to include to make this thing work? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Glen Able |
last post by:
Just to get my head straight on this...
Firstly, am I right in thinking that right-shifting a signed integer has an
undefined result (i.e. could be implemented as a logical or arithmetic
shift)?
If so, am I also right in assuming that if I right-shift a signed integer by
an unsigned integer, the signed value will be promoted to unsigned and the
shift will be performed as a logical right shift?
|
by: maniac |
last post by:
Hey guys, I'm new here, just a simple question.
I'm learning to Program in C, and I was recommended a book called,
"Mastering C Pointers", just asking if any of you have read it,
and if it's worth the $25USD.
I'm just looking for a book on Pointers, because from what I've
read it's one of the toughest topics to understand.
thanks in advanced.
|
by: Kevin |
last post by:
I was looking through some source code and noticed the used of the C# <<
operator. Why is this being used here and under what circumstances is an
left-shift operator useful.
internal enum InterestLevel
{
Ignore = 0,
Display = 1<<0,
Interesting = 1<<1,
Parents = 1<<2,
|
by: Kenneth Lantrip |
last post by:
Anyone got any ideas as to how this process could be improved for speed?
this is what I have...
Dim j, q As Integer
Dim x(16), y(16) As Byte
x.CopyTo(y, 0) ' shift left circular 24 bits
|
by: deepak |
last post by:
If i'm shifting an integer 'n' times where n > sizeof(int), It's giving
the same value as
that of n-sizeof(n). Why is it behaving like this. I studied that the
bit 'll be replaced by '0'.
Example;
int i = 1;
printf ("%d\n", i<<32);
| |
by: jonathanmcdougall |
last post by:
I am developing a calendar on which dates can be clicked and selected.
A calendar is a table in which each day is a cell. Each cell has a
unique id.
By left-clicking on a date, it gets selected (with a blue background).
By then shift-left-clicking on another date, the range between the
first and second dates gets selected. This is a behavior commonly found
on GUI widgets. Therefore, I need to cancel the onMouseDown event so
the browser...
|
by: sandhya |
last post by:
Hello Folks,
i hava a problem in coding of circular left shift of 25 bits in my
program...how do i perform it, and how do i use unsigned in VB.
My program (IDEA algorithm implementation in VB) requires unsigned
bits...so how do i go thro this ,since VB does not support unsigned
operations
Post your suggestions!!!
|
by: Christian Christmann |
last post by:
Hi,
in the header of my class I've a constant
static const int a = ( 1 << 32 ) - 1;
When compiling the code, g++ issues the warning
"warning: left shift count >= width of type"
Why? And how can I get rid of that?
|
by: Cindy |
last post by:
I am struggling over a simple way to shift multi bytes for certain
bits. Hope someone can help. For example, I open a memory space for 10
bytes:
unsigned char *pData = new unsigned char;
then store some value into pData which occupies pData and pData.
Now I want to shift these two bytes to the left for 9 bits and still
store them in pData. The data now should span from the bit0 in
pData to bit1 in pData.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |