On 10/11/2016 10:49 AM, Matthias Bentrup wrote:

void popFrontAsmIntel(ref char[] s) @trusted pure nothrow {
  immutable c = s[0];
  if (c < 0x80) {
    s = s[1 .. $];
  } else {
    uint l = void;
    asm pure nothrow @nogc {
      mov EAX, 1;
      mov BL, 0xf8-1;
      sub BL, c;
      cmp BL, 0xf8-0xc0;
      adc EAX, 0;
      cmp BL, 0xf8-0xe0;
      adc EAX, 0;
      cmp BL, 0xf8-0xf0;
      adc EAX, 0;
      mov l, EAX;
    }
    s = s[l <= $ ? l : $ .. $];
  }
}

Did you take a look at the codegen on http://ldc.acomirei.ru? It's huge. -- Andrei

Reply via email to