LAMMP 4.1.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
print_hex.h
浏览该文件的文档.
1/*
2 * [LAMMP]
3 * Copyright (C) [2025-2026] [HJimmyK(Jericho Knox)]
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#ifndef __LAMMP_PRINT_HEX_H__
20#define __LAMMP_PRINT_HEX_H__
21
22#include "../lmmp.h"
23#include <stdio.h>
24
25static inline void lmmp_print_hex(mp_srcptr num, mp_ssize_t n) {
26 if (n < 0) {
27 printf("-");
28 n = -n;
29 }
30 printf("0x");
31 for (mp_ssize_t i = n - 1; i >= 0; --i) {
32 printf("%016llX", num[i]);
33 }
34 printf("\n");
35}
36
37#endif // __LAMMP_PRINT_HEX_H__
const mp_limb_t * mp_srcptr
Definition lmmp.h:216
int64_t mp_ssize_t
Definition lmmp.h:214
static void lmmp_print_hex(mp_srcptr num, mp_ssize_t n)
Definition print_hex.h:25