![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| bitwise and if | Puntino | High Level Programming | 3 | 04-28-2008 10:22 AM |
| If with set operators | Khoomfire | UNIX for Advanced & Expert Users | 2 | 04-25-2008 08:03 AM |
| Bitwise negation | dLloydm | Shell Programming and Scripting | 3 | 05-17-2007 10:57 AM |
| resetting counter using bitwise XOR | mrgubbala | High Level Programming | 1 | 09-14-2006 01:58 AM |
| bitwise operators | areef4u | UNIX for Advanced & Expert Users | 9 | 08-04-2006 05:39 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Bit-fields and Bitwise operators
Hi,
Is it possible to use bitwise operators in bit fields? For example: typedef struct Mystruct { unsigned char A :1 ; unsigned char B :1 ; } Mystruct; and assume struct Mystruct STR_1S, STR_2S, tempSTRS = {0}; then the following line: tempSTRS = STR_1S & STR_2S; gives the error: operants must have integral type: op "&" One way to overcome the problem is to perform the bitwise operations in each member separelty i.e. tempSTRS.A = STR_1S.A & STR_2S.A; tempSTRS.B = STR_1S.B & STR_2S.B; Is there any other more eficient way? |
| Forum Sponsor | ||
|
|