File: validate_utf32_to_latin1.cpp

package info (click to toggle)
simdutf 7.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,244 kB
  • sloc: cpp: 60,074; ansic: 14,226; python: 3,364; sh: 321; makefile: 12
file content (27 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "validate_utf32.h"

namespace simdutf {
namespace tests {
namespace reference {

simdutf_warn_unused bool validate_utf32_to_latin1(const char32_t *buf,
                                                  size_t len) noexcept {
  const char32_t *curr = buf;
  const char32_t *end = buf + len;

  while (curr != end) {
    const uint32_t word = *curr;

    if (word > 0xFF) {
      return false;
    }

    curr++;
  }

  return true;
}

} // namespace reference
} // namespace tests
} // namespace simdutf