Debian Codegraph @

gcc/testsuite/gcc.dg/vect/pr118749.c

raw
1 /* { dg-additional-options "-mtune=pentium4" { target ia32 } } */
2
3 #include "tree-vect.h"
4
5 typedef unsigned char FcChar8;
6 typedef unsigned short FcChar16;
7 typedef unsigned int FcChar32;
8 typedef int FcBool;
9
10 #define FcFalse 0
11 #define FcTrue 1
12 #define FcDontCare 2
13
14 __attribute__((noipa))
15 static FcBool
16 FcLooksLikeSJIS (FcChar8 *string, int len)
17 {
18 int nhigh = 0, nlow = 0;
19
20 while (len-- > 0)
21 {
22 if (*string++ & 0x80) nhigh++;
23 else nlow++;
24 }
25 /*
26 * Heuristic -- if more than 1/3 of the bytes have the high-bit set,
27 * this is likely to be SJIS and not ROMAN
28 */
29 if (nhigh * 2 > nlow)
30 return FcTrue;
31 return FcFalse;
32 }
33
34 int main()
35 {
36 check_vect ();
37 unsigned char* s = "DejaVuMathTeXGyre-Regulardtd!";
38 if (FcLooksLikeSJIS(s, 29))
39 abort ();
40 return 0;
41 }