Integer Division on 32 Bit Machines

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

 



Hello,

I have encountered a problem on my 32 bit machine. Here some code
snippets:

typedef signed long s64;
asmlinkage long sys_optStopMeasure(int __user workamount) {

	s64 currentPerformance, currentTimePerWork;
	
	...

	currentTimePerWork = currentPerformance / workamount;

	...
}

When I run a make, I get this error at the end:
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
optimizer/built-in.o: In function `sys_optStopMeasure':
/source/trunk/linux-2.6.34/optimizer/sys_optStopMeasure.c:144: undefined
reference to `__divdi3'

Another person which has tried the code had no problems - he compiled
the code for a 64 bit machine. Can you explain to me the problem? Why
does the code work on 64 but not on 32 bit?

I've looked for some workarounds and found do_div(). Is this the way to
go? Or are there better ways?

Thanks 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