TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

3 pointsby r4umalmost 2 years ago

1 comment

Someonealmost 2 years ago
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)