在uint128_t整数范围内的十六进制字符串操作 [英] Operations on hexadecimal strings in context of uint128_t integers

查看:724
本文介绍了在uint128_t整数范围内的十六进制字符串操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关标准的Linux库函数 strtoull将的上限是64位。

是否存在为 strtoX 为Linux x86_64的环境 - 家庭功能上 uint128_t 整数操作的实施<? / p>

可能的原型:

  uint128_t strtoulll(为const char * NPTR,焦炭** endptr,INT基地);

此外,你怎么能打印 uint128_t 使用整数的printf / 的sprintf


解决方案

有没有类型 uint128_t 为标准。 A型 __ int128 被提及作为公共扩展只有在的 J.5.6 ,但仍然没有官方标准的一部分(和上市的类型显然签字,不签名)。

注意 strtoull将&安培;家庭是标准的一部分,而不是Linux(不管的Linux是指在这里)。

所以:有转换,既不给printf没有标准的方法。

The upper limit for standard Linux library function strtoull is 64 bits.

Does there exist an implementation for strtoX-family function for Linux x86_64 environment that operates on uint128_t integers?

Possible prototype:

uint128_t strtoulll(const char *nptr, char **endptr, int base);

Also, how can you print uint128_t integers using printf/sprintf?

解决方案

There is no type uint128_t as of the standard. A type __int128 is mentioned as "common extension" only in J.5.6, but still not part of the official standard (and the type listed is apparently signed, not unsigned).

Note that strtoull & family are part of the standard, not Linux (whatever "Linux" means here).

So: there is no standard way to convert, neither to printf.

这篇关于在uint128_t整数范围内的十六进制字符串操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆