Odd modulus problem w/GCC 4.1.2
Odd modulus problem w/GCC 4.1.2
I'm most likely missing something very basic, but I'm having a big problem using the % operator in GCC 4.1.2. The form of modulus that's manifesting itself in my setup retains some functionality, but is only mildly useful. It's kind of just behaving like a boolean "Is there a remainder?" function. It just seems to spit out 0 if there is no remainder, and the second operand if there is one. I.E. 42 % 24 = 0, but 30 % 12 = 12. Anyone have any insight?
well 30 % 12 should be 6... hmm, reinstall?
or maybe there is a different logic, 6*2 = 12, and that is the value given earlier. are you sure it is always the second value being returned?
either way, its a reinstallable issue.
or maybe there is a different logic, 6*2 = 12, and that is the value given earlier. are you sure it is always the second value being returned?
either way, its a reinstallable issue.
Website: https://joscor.com
The 30 % 12 was kind of pulled out of thin air (although I did test that number for the sake of due diligence before posting lol). I first noticed it when some padding code wasn't working correctly, so it was more on the order of x % PAGE_SIZE, and always getting PAGE_SIZE if there was a remainder. I've been working around it since then, since I save cycles not caring what the remainder is on that, anyway. However, I'm trying to go back through my code now that I've gotten somewhat far along and replace some rudimentary linear lookups with hash tables, so I kind of need it now.
It's the prebuilt package from Debian 4.0r0. The problem doesn't occur in programs compiled normally (e.g. gcc -o foo foo.c) w/glibc et. al. It only occurs in my kernel code. My pertinent compilation parameters are '-Wall -Werror -nostartfiles -no-stdlib -no-stdinc -fno-builtin', if that helps.
It's the prebuilt package from Debian 4.0r0. The problem doesn't occur in programs compiled normally (e.g. gcc -o foo foo.c) w/glibc et. al. It only occurs in my kernel code. My pertinent compilation parameters are '-Wall -Werror -nostartfiles -no-stdlib -no-stdinc -fno-builtin', if that helps.