LMMP 4.3.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
to_hex.c 文件参考
#include "impl/str_conv.h"
#include "mparam.h"
#include "lmmp/lmmpn.h"
to_hex.c 的引用(Include)关系图:

浏览该文件的源代码.

函数

mp_size_t lmmp_to_hex_len_ (mp_srcptr numa, mp_size_t na)
 Copyright (C) 2026 HJimmyK (Jericho Knox)

函数说明

◆ lmmp_to_hex_len_()

mp_size_t lmmp_to_hex_len_ ( mp_srcptr numa,
mp_size_t na )

Copyright (C) 2026 HJimmyK (Jericho Knox)

计算转换为十六进制字符串需要的缓冲区长度

This file is part of LMMP.

LMMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see https://www.gnu.org/licenses/.

SPDX-License-Identifier: LGPL-3.0-or-later

Copyright (C) 2026 HJimmyK (Jericho Knox)

参数
numa输入指针,长度为na
na输入的 limb 长度
警告
na>=0
注解
将会忽略numa的前导零limb,
  1. if (numa!=NULL) 返回精确的十六进制字符长度(零值返回0)
  2. if (numa==NULL) 返回na个limb长度的数的最大可能字符长度(最坏情况)
返回
十六进制字符数

在文件 to_hex.c 第 28 行定义.

28 {
29 if (numa) {
30 do {
31 if (na == 0)
32 return 0;
33 } while (numa[--na] == 0);
34 // na 现为最高非零 limb 下标
35 return (LIMB_BITS * na + lmmp_limb_bits_(numa[na]) + 3) >> 2;
36 }
37 return na << 4;
38}
#define lmmp_limb_bits_
#define LIMB_BITS
定义 lmmp.h:102

引用了 LIMB_BITS, lmmp_limb_bits_ , 以及 lmmp_to_hex_len_().

被这些函数引用 check_hex_one(), lmmp_to_hex_len_() , 以及 TEST_CASE().

函数调用图:
这是这个函数的调用关系图: