TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Transcoding UTF-8 strings to Latin 1 strings at 18 GB/s using AVX-512

3 点作者 r4um将近 2 年前

1 comment

Someone将近 2 年前
I think this code fails on some UTf-8 strings that can be converted to Latin1: those using combining characters to encode accented characters such as ‘é’.<p>And nitpick: using zero as the error return value means callers will think empty strings cannot be converted to latin1. I would use minus one as the error value, or, maybe, the negated byte offset of the first failure found minus one (can be helpful, but easily misinterpreted by the caller)