scripts: add onetest_gesamt for arm64
[testub10.git] / gesamt / codeb_georg_asma_03.0
1 /** asma - aka tolower() first 16 bytes.
2  *
3  *      unsigned char *asma(unsigned char *s)
4  *      {
5  *              int i;
6  *              for (i=0; i<16; i++)
7  *              {
8  *                      unsigned char c = s[i];
9  *                      c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
10  *                      s[i] = c;
11  *              }
12  *              return s;
13  *      }
14  */
15 /* AMD64 Little Endian byte order
16  * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
17  * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
18  * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
19  * p[0] - 256 * p[1]   c0
20  */
21 /* WISHLIST signed!? */
22 struct f end;
23 method asma()
24         var p := this;
25         var q := this--16;
26         while p < q
27         do
28                 var a := p.f;
29                 var b := (p--1).f;
30                 var c := a - (256 * b);
31
32                 /* add 'a'-'A' iff 'A' <= c <= 'Z' */
33                 if 0x40 < c then if c < 0x5B then
34                         c := c--0x20;
35                 end;
36                 end;
37
38                 p.f := (256 * b) -(0-c);
39
40                 p := p--1;
41         end;
42         return this;
43 end;