scripts: add onetest_gesamt for arm64
[testub10.git] / gesamt / codeb_georg_asma_04.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 c := p.f - (256 * (p--1).f);
29
30                 /* add 'a'-'A' iff 'A' <= c <= 'Z' */
31                 if 0x40 < c then if c < 0x5B then
32                         c := c--0x20;
33                 end;
34                 end;
35
36                 p.f := (256 * (p--1).f)-(0-c);
37
38                 p := p--1;
39         end;
40         return this;
41 end;