bigdutils.c
来自「大数的计算包括加减乘除」· C语言 代码 · 共 87 行
C
87 行
/* bigdUtils.c */
/******************* SHORT COPYRIGHT NOTICE*************************
This source code is part of the BigDigits multiple-precision
arithmetic library Version 1.0 originally written by David Ireland,
copyright (c) 2001 D.I. Management Services Pty Limited, all rights
reserved. It is provided "as is" with no warranties. You may use
this software under the terms of the full copyright notice
"bigdigitsCopyright.txt" that should have been included with
this library. To obtain a copy send an email to
<code@di-mgt.com.au> or visit <www.di-mgt.com.au/crypto.html>.
This notice must be retained in any copy.
****************** END OF COPYRIGHT NOTICE*************************/
#include <stdio.h>
#include "bigdigits.h"
void mpPrint(DIGIT_T *p, unsigned int len)
{
while (len--)
{
printf("%08lx ", p[len]);
}
}
void mpPrintNL(DIGIT_T *p, unsigned int len)
{
unsigned int i = 0;
while (len--)
{
if ((i % 8) == 0 && i)
printf("\n");
printf("%08lx ", p[len]);
i++;
}
printf("\n");
}
void mpPrintTrim(DIGIT_T *p, unsigned int len)
{
/* Trim leading zeroes */
while (len--)
{
if (p[len] != 0)
break;
}
len++;
while (len--)
{
printf("%08lx ", p[len]);
}
}
void mpPrintTrimNL(DIGIT_T *p, unsigned int len)
{
unsigned int i = 0;
/* Trim leading zeroes */
while (len--)
{
if (p[len] != 0)
break;
}
len++;
while (len--)
{
if ((i % 8) == 0 && i)
printf("\n");
printf("%08lx ", p[len]);
i++;
}
printf("\n");
}
/* Print functions for BigDigit structures */
void bpPrint(BIGD_T *p)
{
unsigned int i = p->ndigits;
while (i--)
{
printf("%08lx ", p->digits[i]);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?