Hot answers tagged 32-bit
The 64-bit extension for 80x86 processors (nowadays called just x86) was invented by AMD. Back then Intel was betting on the Itanium line for servers and even went on record saying that "64 bits won't be needed on the desktop anytime soon". AMD, on the other hand, was producing the successful Athlon line, which for a short while was much faster and ...
The number is treated as an unsigned integer in this case which means all bits set will not produce -1 (if if where signed then yes, it would be correct). So all 16 bits set will give you 65535. Interesting enough though, signed state isn't a factor when doing logic bit-operations. Bits are themselves not signed as they are the lowest component in a ...
It is trivial. 65535 in binary is all ones, so ANDing it with any X less than 65535 will give you X.
I would like to have a [...] way of creating unique error numbers, across projects and across developers. IMHO that is the bad idea. You should avoid the need for having a global unique error number across project boundaries. That is a global requirement you cannot fulfill as soon as you need to add third-party components, and at the long run, it will ...
IPv4 is a very good example where a limited spec size caused a very expensive problem down the line. 4.3 billion addresses just aren't enough anymore. Now ISPs around the world are desparately rolling out IPv6 with a 128-bit address space which translates into an address for every atom in your body or something like that.
Answering the second part of your question. You've tagged it as 32-bit so, 65535 in 32 bits is 00000000000000001111111111111111, signed or unsigned it is not -1.
This works brilliantly on 64 bit machines, but the resulting integer is too large for 32 bit computers. Actually, 32 bit computers can handle 64 bit numbers just fine. OK, so 64 bit arithmetic might take a few extra clock cycles on a 32 bit machine, but this is unlikely to be significant. (Or even relevant ... in your use-case.) For instance, the ...
Why not use a string data type for the error code instead of a number? This will allow large code to be stored without any issues as to integer size. Even though the error code does look like a number, unless the design is calling for arithmetic with it then it is not a number, then it really should be a string data type. I'm also a little concerned ...
You have choices: everyone uses the same architecture as you're providing to users. If you ship 64 bit, then develop on 64bit. Everyone uses whatever dev architecture they like, and you ensure quality through a good integration environment, or multiple if you ship different versions. There are problems, but these are quite temporary - in that you might ...
Here's a good jumping off point for one version, the "497 day bug."
The Handbook of Floating-point Arithmetic, while rather expensive, is about as comprehensive a reference as you can get on the subject. It's designed with applicative uses in mind though it may be hard to parse the formal sections of math contained there-in. However, it will give a solution set for division in both hardware and software if you can parse the ...
This is a very bad idea. You want "Easy and memorable". You've already discovered that your solution isn't easy. You're considering backing yourself into a 64-bit corner to solve this problem. What happens when Mary Smith and Mike Simpson join the team? How can you guarantee uniqueness of the numeric part? Whenever you rely on programmer memory, you place ...
Let a database create your unique number for you -- log the error to a sql db, and your problem is solved. Include application info (ie what app encountered the error) and Bob's your uncle.
There's far less probability of issues if you all use the same toolchain. There may not ever be a problem, but can you soak the time spent investigating why "it works on my machine" for our 64bit friends, and not with your 32bit ones if there is? It's usually the best option to go with lowest common denominator. Behaviour does sometime differ from platform ...
Given the division: AAABBBCCC / X it can be rewritten to the form: (AAA * 10^6 / X) + (BBB * 10^3 / X) + (CCC / X). These algebraic formulae, plus or minus some division or multiplication by powers of 10, will get the answer.
The year 2000 problem was similar, except that people used decimal numbers instead of binary, and encoded just two last digits. This can be a useful example if explaining to someone who has little experience with binary. FAT12/FAT16/FAT32 were adapted to cover for bigger and bigger storage. TeX has some interesting properties when representing dimensions ...
Only top voted, non community-wiki answers of a minimum length are eligible