unsigned long result = ((unsigned long)myVariable) >> myShift;
BTW I have got so used to the new C++ style of casting, where the variable
goes inside brackets and you therefore know unequivocally the scope of the
cast, that I can't imagine why C# uses the old C-style casts.
PS... perhaps you should be using an unsigned type in the first place?
S.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.