X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=testub10.git;a=blobdiff_plain;f=gesamt%2Fcodeb_georg_asma_03.0;fp=gesamt%2Fcodeb_georg_asma_03.0;h=3d565253778b2bbb1b4bab544a7e003892aedc00;hp=0000000000000000000000000000000000000000;hb=029401d51612c5e69d7ac8603e1b69cd7ed6ef96;hpb=bf19094ac2573112418701ba4c6abf5779e3a9f7 diff --git a/gesamt/codeb_georg_asma_03.0 b/gesamt/codeb_georg_asma_03.0 new file mode 100644 index 0000000..3d56525 --- /dev/null +++ b/gesamt/codeb_georg_asma_03.0 @@ -0,0 +1,43 @@ +/** asma - aka tolower() first 16 bytes. + * + * unsigned char *asma(unsigned char *s) + * { + * int i; + * for (i=0; i<16; i++) + * { + * unsigned char c = s[i]; + * c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0; + * s[i] = c; + * } + * return s; + * } + */ +/* AMD64 Little Endian byte order + * p[0] c0 c1 c2 c3 c4 c5 c6 c7 + * p[1] c1 c2 c3 c4 c5 c6 c7 c8 + * p[1] * 256 00 c1 c2 c3 c4 c5 c6 c7 + * p[0] - 256 * p[1] c0 + */ +/* WISHLIST signed!? */ +struct f end; +method asma() + var p := this; + var q := this--16; + while p < q + do + var a := p.f; + var b := (p--1).f; + var c := a - (256 * b); + + /* add 'a'-'A' iff 'A' <= c <= 'Z' */ + if 0x40 < c then if c < 0x5B then + c := c--0x20; + end; + end; + + p.f := (256 * b) -(0-c); + + p := p--1; + end; + return this; +end;