473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

((u32) (0-1) << (24)) ?

I am study a source code, and i passed over this expression, I know what it does, but i want to know why the expression wasn't write in this form ((u32) 1 << (24)).
Thx

#typedef unsigned long u32
May 3 '07 #1
2 3669
JosAH
11,448 Expert 8TB
I am study a source code, and i passed over this expression, I know what it does, but i want to know why the expression wasn't write in this form ((u32) 1 << (24)).
Thx

#typedef unsigned long u32
Those two expressions aren't the same: (assuming a 32 bit unsigned long)
the first one equals 0xff000000L while the second one is 0x01000000L.

The '-' (minus) operator has higher precedence than the << (shift left) operator.
0-1 causes wrap around to all bits 1. The expression could also be written as:

1) ~0<<24
2) 0xff<<24

and I'm sure many more ways exist to write this expression.

kind regards,

Jos
May 3 '07 #2
Can you please explain to me the processing of the expression, like is done from the compiler, and can you use please numbers in base 2. I want to know all the operations that are done, and their precedence, before the final result comes out.
Thx
May 3 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Alex Martelli | last post by:
I have fixed almost all of the outstanding bugreports and feature request for gmpy: divm doesn't leak memory any more, truediv and floordiv are implemented for all types, etc -- in the current CVS...
5
by: Baldy | last post by:
Hi all, just came across a reall tricky one, perhaps some smart cookie out there can help. I'm querying patient data from our hospital it might look like this UR Date ...
7
by: MLH | last post by:
?2944*24 gives me an overflow error, entered in the immediate window. Anybody else?
5
by: HSP | last post by:
hi. i need to restore an old database. The db was backed up using a DLT drive, using 2 volumes. The content for the tapes was copied to file onto Solaris machine using rsh and dd (for backup...
2
by: mtech1 | last post by:
Access 2003 I need to create a query to view data by 3 - 24 hour shifts. Ex: There are 3 shifts, each shift is 24 hours starting at 0700 through 0700. Each shift is designated as A, B, or C. ...
3
by: vicyankees | last post by:
I am creating a report that has call duration and if i run it over a multi-day span the duration is limited to 24 hours and starts over at zero. is there a way to not limit hours? I am usign...
34
by: aljamala | last post by:
I keep getting this error for the given code region (it actually highlights the line with the body tag): line 42 column 1 - Warning: <trisn't allowed in <bodyelements </head> <body...
1
by: Bill | last post by:
I have a large number of records that have an elapsed time in seconds for each one that I was to have a total time spent. I can sum them up with query easily enough but I need to be able to display...
1
by: chris10121 | last post by:
Pretend you have a mysql calendar that looks like the following: id - date - appointment_start_time - appointment_end_time - title 1 - 2008-01-17 - 11:00 - 11:30 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.