Re: Integer Division on 32 Bit Machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

On Wed, Sep 08, 2010 at 11:14:30PM -0700, Dave Hylands wrote:
> Replying to the list this time...
 
finally an answer to *my* problem, thanks :-D

> Another general rule, is that on 32-bit CPUs you can only do 32-bit
> arithmetic, with 64-bit addition, subtraction, and multiplications.
> 64-bit divides must be done using do_div or do_div64.
> 

I've understood so far your explanations. But one thing I am missing: I
claim that I do not do an 64-bit division, but an 32-bit division. 

Why? I have run make tags to create an architecture dependent tags file.
When I go to s64 and jump to the definition I land in
include/asm-generic/int-l64.h . There is the typedef: 

typedef signed long s64;

On my system, the size of long int is the same as int (I've wrote a
simple C program to get this information). I.e. there should be no
difference between an 'signed int division' and an 'signed long
division'. What am I missing?

Another question: I've encountered several #ifdef __ASSEMBLY__ and
__KERNEL__ in the header files. What do these two preprocessor
definitions stand for? 

Thanks in advance for your help!
Andreas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux