Meep

sentry

Jul 28th, 2021 (edited)
813
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static unsigned int bit_mob0(const UINT64 p1, const UINT64 p0)
  2. {
  3.  UINT64 fl1, fr1, ml1, mr1, s1, t;
  4.  fl1 = p1 | p0 & p1 << 8;
  5.  fr1 = p1 | p0 & p1 >> 8;
  6.  ml1 = p0 & p0 << 8;
  7.  mr1 = p0 & p0 >> 8;
  8.  fl1 |= ml1 & fl1 << 16;
  9.  fr1 |= mr1 & fr1 >> 16;
  10.  ml1 &= ml1 << 16;
  11.  mr1 &= mr1 >> 16;
  12.  fl1 |= ml1 & fl1 << 32;
  13.  fr1 |= mr1 & fr1 >> 32;
  14.  t = (fl1 & p0) << 8 | (fr1 & p0) >> 8;
  15.  s1 = p0 & 0x7E7E7E7E7E7E7E7E; // hor
  16.  fl1 = p1 | s1 & p1 << 1;
  17.  fr1 = p1 | s1 & p1 >> 1;
  18.  ml1 = s1 & s1 << 1;
  19.  mr1 = s1 & s1 >> 1;
  20.  fl1 |= ml1 & fl1 << 2;
  21.  fr1 |= mr1 & fr1 >> 2;
  22.  ml1 &= ml1 << 2;
  23.  mr1 &= mr1 >> 2;
  24.  fl1 |= ml1 & fl1 << 4;
  25.  fr1 |= mr1 & fr1 >> 4;
  26.  t |= (fl1 & s1) << 1 | (fr1 & s1) >> 1;
  27.  s1 = p0 & 0x007E7E7E7E7E7E00; // diag1
  28.  fl1 = p1 | s1 & p1 << 7;
  29.  fr1 = p1 | s1 & p1 >> 7;
  30.  ml1 = s1 & s1 << 7;
  31.  mr1 = s1 & s1 >> 7;
  32.  fl1 |= ml1 & fl1 << 14;
  33.  fr1 |= mr1 & fr1 >> 14;
  34.  ml1 &= ml1 << 14;
  35.  mr1 &= mr1 >> 14;
  36.  fl1 |= ml1 & fl1 << 28;
  37.  fr1 |= mr1 & fr1 >> 28;
  38.  t |= (fl1 & s1) << 7 | (fr1 & s1) >> 7;
  39.  fl1 = p1 | s1 & p1 << 9;
  40.  fr1 = p1 | s1 & p1 >> 9; // diag2
  41.  ml1 = s1 & s1 << 9;
  42.  mr1 = s1 & s1 >> 9;
  43.  fl1 |= ml1 & fl1 << 18;
  44.  fr1 |= mr1 & fr1 >> 18;
  45.  ml1 &= ml1 << 18;
  46.  mr1 &= mr1 >> 18;
  47.  fl1 |= ml1 & fl1 << 36;
  48.  fr1 |= mr1 & fr1 >> 36;
  49.  t |= (fl1 & s1) << 9 | (fr1 & s1) >> 9;
  50.  return ((unsigned int)__popcnt64(t & (~(p0 | p1))));
  51. }
RAW Paste Data