Click here to Skip to main content
15,892,697 members
Home / Discussions / C#
   

C#

 
QuestionEmbedded Forms? Panels? Other? Pin
tim.walter20-Oct-11 3:33
tim.walter20-Oct-11 3:33 
AnswerRe: Embedded Forms? Panels? Other? Pin
Wayne Gaylard20-Oct-11 4:12
professionalWayne Gaylard20-Oct-11 4:12 
GeneralRe: Embedded Forms? Panels? Other? Pin
tim.walter20-Oct-11 4:20
tim.walter20-Oct-11 4:20 
GeneralRe: Embedded Forms? Panels? Other? Pin
Wayne Gaylard20-Oct-11 4:27
professionalWayne Gaylard20-Oct-11 4:27 
GeneralRe: Embedded Forms? Panels? Other? Pin
tim.walter20-Oct-11 4:30
tim.walter20-Oct-11 4:30 
GeneralRe: Embedded Forms? Panels? Other? Pin
BobJanova20-Oct-11 4:46
BobJanova20-Oct-11 4:46 
AnswerRe: Embedded Forms? Panels? Other? Pin
PIEBALDconsult20-Oct-11 4:21
mvePIEBALDconsult20-Oct-11 4:21 
Questionusing bitwise operators on ushort Pin
__John_20-Oct-11 2:37
__John_20-Oct-11 2:37 
Hi,

I have a function that converts r(red), g(green) and b(blue) values to a uint (same as RGB macro in C++).

If I implement as follows I get no errors or warnings:

C#
private uint rgb(byte r, byte g, byte b)
{
    return ((uint)((r|((uint)(g)<<8))|(((uint)b)<<16)));
}


However, if I implement like this:

C#
private uint rgb(byte r, byte g, byte b)
{
    return ((uint)((r|((ushort)(g)<<8))|(((uint)b)<<16)));
}


I get a warning "Bitwise or operator used on a sign extended operand".

But ushort is un-signed, so why am I getting the warning?


Thanks - John.
AnswerRe: using bitwise operators on ushort Pin
BobJanova20-Oct-11 3:09
BobJanova20-Oct-11 3:09 
AnswerRe: using bitwise operators on ushort Pin
Richard MacCutchan20-Oct-11 3:25
mveRichard MacCutchan20-Oct-11 3:25 
GeneralRe: using bitwise operators on ushort Pin
__John_20-Oct-11 3:44
__John_20-Oct-11 3:44 
GeneralRe: using bitwise operators on ushort Pin
Richard MacCutchan20-Oct-11 4:11
mveRichard MacCutchan20-Oct-11 4:11 
QuestionHow to generate the area of the irregular polygon Pin
sivakumarmr1019-Oct-11 21:10
sivakumarmr1019-Oct-11 21:10 
AnswerRe: How to generate the area of the irregular polygon Pin
BillWoodruff19-Oct-11 22:04
professionalBillWoodruff19-Oct-11 22:04 
AnswerRe: How to generate the area of the irregular polygon Pin
BobJanova19-Oct-11 22:15
BobJanova19-Oct-11 22:15 
GeneralRe: How to generate the area of the irregular polygon Pin
CDP180219-Oct-11 22:57
CDP180219-Oct-11 22:57 
AnswerRe: How to generate the area of the irregular polygon Pin
Pascal Ganaye19-Oct-11 23:24
Pascal Ganaye19-Oct-11 23:24 
GeneralRe: How to generate the area of the irregular polygon Pin
Luc Pattyn19-Oct-11 23:44
sitebuilderLuc Pattyn19-Oct-11 23:44 
GeneralRe: How to generate the area of the irregular polygon Pin
BobJanova20-Oct-11 0:30
BobJanova20-Oct-11 0:30 
GeneralRe: How to generate the area of the irregular polygon Pin
BillWoodruff20-Oct-11 19:43
professionalBillWoodruff20-Oct-11 19:43 
QuestionGet free memory Pin
Mehdi Gholam19-Oct-11 20:19
Mehdi Gholam19-Oct-11 20:19 
AnswerRe: Get free memory Pin
André Kraak19-Oct-11 21:35
André Kraak19-Oct-11 21:35 
AnswerRe: Get free memory Pin
OriginalGriff19-Oct-11 22:39
mveOriginalGriff19-Oct-11 22:39 
AnswerRe: Get free memory Pin
Dave Kreskowiak20-Oct-11 1:53
mveDave Kreskowiak20-Oct-11 1:53 
QuestionDataGridView question Pin
Tom Paronis19-Oct-11 11:55
Tom Paronis19-Oct-11 11:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.