sonic-cpp
sonic-cpp copied to clipboard
error "__builtin_uaddll_overflow’在此作用域中尚未声明"
__builtin_uaddll_overflow’在此作用域中尚未声明
sonic/include/sonic/internal/arch/avx2/simd.h:50:49: 错误:不能在初始化时将‘__m128i {aka __vector(2) long long int}’转换为‘long long int’ sonic_force_inline base128() : value{__m128i()} {}
__builtin_uaddll_overflow’在此作用域中尚未声明
-mavx2 -mpclmul -mbmi都加了
sonic_force_inline base128() : value{__m128i()} {} 改为 sonic_force_inline base128() : value(_mm_setzero_si128()) {} sonic_force_inline base256() : value{__m256i()} {} 改为 sonic_force_inline base256() : value(_mm256_setzero_si256()) {} sonic_force_inline bool AddOverflow(uint64_t value1, uint64_t value2, uint64_t* result) { return __builtin_uaddll_overflow( value1, value2, reinterpret_cast<unsigned long long*>(result)); } 改为 sonic_force_inline bool AddOverflow(uint64_t value1, uint64_t value2, uint64_t* result) { if (value1 > std::numeric_limits<uint64_t>::max() - value2) { // Overflow would occur return true; } result = value1 + value2; return false; //return __builtin_uaddll_overflow( //value1, value2, reinterpret_cast<unsigned long long>(result)); } 临时解决编译不通过的问题
感谢反馈,看起来是环境中该编译器不支持 __builtin_uaddll_overflow 扩展
@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错 example里写的是const sonic_json::Node& key = m->name;
正确应该是 const sonic_json::Node& key = m->name
, 目的是防止用户将 object 暴露的 key set 成非string的类型,后续我们会更新readme,感谢~
@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错 example里写的是const sonic_json::Node& key = m->name;
@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错 example里写的是const sonic_json::Node& key = m->name;
fixed #79
感谢反馈,看起来是环境中该编译器不支持 __builtin_uaddll_overflow 扩展
编译器有个内置的函数来 check builtin 是否支持,我们可以加上这个 check,这样可以更友好的提前暴露这个问题?