111
|
1 /* { dg-do run } */
|
|
2 /* { dg-options "-O3" } */
|
|
3
|
|
4 #define PACKED __attribute__(( packed ))
|
|
5
|
|
6 struct PACKED aostk_point_u8 {
|
|
7 unsigned char x;
|
|
8 unsigned char y;
|
|
9 };
|
|
10
|
|
11 struct PACKED aostk_size_u8 {
|
|
12 unsigned char width;
|
|
13 unsigned char height;
|
|
14 };
|
|
15
|
|
16 struct PACKED aostk_glyph {
|
|
17 unsigned short i;
|
|
18 struct aostk_size_u8 size;
|
|
19 char top;
|
|
20 struct aostk_point_u8 advance;
|
|
21 unsigned char pitch;
|
|
22 unsigned char* data;
|
|
23 char left;
|
|
24 };
|
|
25
|
|
26
|
|
27 struct PACKED aostk_font {
|
|
28 unsigned short numglyphs;
|
|
29 unsigned char height;
|
|
30 struct aostk_glyph* glyphs;
|
|
31 };
|
|
32
|
|
33 struct aostk_font glob_font;
|
|
34
|
|
35 static struct aostk_glyph* aostk_get_glyph(struct aostk_font* f, unsigned int c) {
|
|
36 return f->glyphs;
|
|
37 }
|
|
38
|
|
39 int aostk_font_strwidth(struct aostk_font* font, const char* str) {
|
|
40 struct aostk_glyph* g = aostk_get_glyph(font, 0);
|
|
41 return (g != 0);
|
|
42 }
|
|
43
|
|
44 struct aostk_font*
|
|
45 __attribute__ ((noinline, noclone))
|
|
46 get_some_font (void)
|
|
47 {
|
|
48 return &glob_font;
|
|
49 }
|
|
50
|
|
51 int main (int argc, char *argv[])
|
|
52 {
|
|
53 return (int) aostk_font_strwidth (get_some_font (), "sth");
|
|
54
|
|
55 }
|