2010年9月16日星期四

[转载]Linux内核中64位除法函数do_div


Linux内核中64 bit division

使用asm/div64.h中宏do_div

#include <asm/div64.h>
unsigned long long x,y,result;
unsigned long mod;
mod = do_div(x,y);
result = x; 

    64 bit division 结果保存在x中;余数保存在返回结果中。
     
    --- End --- 

没有评论:

发表评论