📄 mp_misc.cpp
字号:
/************************************************** Misc MP Functions Source File ** (C) 1999-2002 The Botan Project **************************************************/#include <botan/mp_core.h>extern "C" {/************************************************** Division Core **************************************************/bool bigint_divcore(word q, word y_1, word y_2, word x_1, word x_2, word x_3) { dword product = (dword)q * y_2; y_2 = MP_LOW_WORD(product); product = (dword)q * y_1 + MP_HIGH_WORD(product); y_1 = MP_LOW_WORD(product); word y_0 = MP_HIGH_WORD(product); if(y_0 > x_1) return true; if(y_0 < x_1) return false; if(y_1 > x_2) return true; if(y_1 < x_2) return false; if(y_2 > x_3) return true; if(y_2 < x_3) return false; return false; }/************************************************** Compare **************************************************/s32bit bigint_cmp(const word* x, u32bit x_size, const word* y, u32bit y_size) { if(x_size < y_size) { return (-bigint_cmp(y, y_size, x, x_size)); } while(x_size > y_size) { if(x[x_size-1]) return 1; x_size--; } for(u32bit j = x_size; j > 0; j--) { if(x[j-1] > y[j-1]) return 1; if(x[j-1] < y[j-1]) return -1; } return 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -