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

浏览该文件的源代码.

函数

mp_size_t lmmp_from_hex_len_ (const char *src, mp_size_t len)
 Copyright (C) 2026 HJimmyK (Jericho Knox)

函数说明

◆ lmmp_from_hex_len_()

mp_size_t lmmp_from_hex_len_ ( const char * src,
mp_size_t len )

Copyright (C) 2026 HJimmyK (Jericho Knox)

计算十六进制字符串转limb数组所需的 limb 缓冲区长度

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)

参数
src输入字符串指针
len字符串长度
警告
len>=0
注解
将会忽略字符串末尾的'0'(值前导零),
  1. if (src!=NULL) 返回精确的 limb 长度(零值返回0)
  2. if (src==NULL) 返回len个字符的最大可能 limb 长度(最坏情况)
返回
所需的 limb 缓冲区长度

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

28 {
29 if (src) {
30 // 忽略末尾的 '0'(值前导零,字符串低位在前)
31 do {
32 if (len == 0)
33 return 0;
34 } while (src[--len] == '0');
35 ++len;
36 }
37 return (len + 15) >> 4;
38}

引用了 lmmp_from_hex_len_().

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

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