Pergunta

I need to do an integer division in a kernel module and I am using do_div() for that. It seems to work on my machine (I have an i686 processor), however I am not sure that it works everywhere. Could anyone confirm whether do_div() should function correctly in 32 bit and 64 bit architectures, or whether there are any know limitations ?

I use Ubuntu 10.04 with kernel 2.6.38, so I am interested in support for kernels >= 2.6.38.

I would also be interested if anyone knows a better way to do an integer division in the kernel than do_div().

Best Regards

Daniel

Foi útil?

Solução

do_div() does work on 64bit arch, but unless you really need the remainder and is fully aware of the effects of using do_div(), you should probably be doing bit shifts instead.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top