# HAL mulorshift, and divorshift,

(one? ( op -- ?op f )
  if "op" is an immediate with the value 1, yield f=1 and "op" is absent.
  Otherwise, f=0 and "op" is unchanged.

?shiftable ( op -- op f )
  If "op" is an immediate and that this immediate is a power of 2, change that
  immediate so that it's a log2 of that immediate. In that case, f=1 and op is
  changed, otherwise, f=0 and op is unchanged.

  When f=1, the change is applied while preserving the dest register.

?modmask ( op -- op f )
  Like ?shiftable, but if f=1, n-1 (a mask). For example, if i is 8, mask is 7.

mulorshift, ( op -- )
  If "op" is an immediate and is also a power of 2, generate a left shift with
  "<<,". If immediate is 1, nothing is generated. Otherwise, do "*,"

divorshift, ( op -- )
  If "op" is an immediate and is also a power of 2, generate a right shift with
  ">>,". If immediate is 1, nothing is generated. Otherwise, do "/mod,"

modorand, ( op -- )
  If "op" is an immediate and is also a power of 2, generate a "&,".
  Otherwise, do "/mod," followed by a copy of S to dst.

  To be consistent with the rest of the HAL, when op has dir) applied, S is
  copied to "op" instead of being copied to dst.

[*n] ( n -- n ) *I*
  Compiles a "mulorshift," of n by immediate value fetched by "n<" [doc/dict].

[*n+] ( n a -- a ) *I*
  Compile a multiplication of "n" by an immediate value fetched by "n<" followed
  by an addition to "a". In other words, an indexing operation.
