Skip to content

Commit

Permalink
format table
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Aug 21, 2024
1 parent 35e85a5 commit bc6fba6
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -1761,39 +1761,40 @@ Comparisons:

Other operations:

| Name | Inputs | Outputs | Meaning |
| ---------------------- | ------------------ | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `imax_u<N>` | `int<N>`, `int<N>` | `int<N>` | maximum of unsigned integers |
| `imax_s<N>` | `int<N>`, `int<N>` | `int<N>` | maximum of signed integers |
| `imin_u<N>` | `int<N>`, `int<N>` | `int<N>` | minimum of unsigned integers |
| `imin_s<N>` | `int<N>`, `int<N>` | `int<N>` | minimum of signed integers |
| `iadd<N>` | `int<N>`, `int<N>` | `int<N>` | addition modulo 2^N (signed and unsigned versions are the same op) |
| `isub<N>` | `int<N>`, `int<N>` | `int<N>` | subtraction modulo 2^N (signed and unsigned versions are the same op) |
| `ineg<N>` | `int<N>` | `int<N>` | negation modulo 2^N (signed and unsigned versions are the same op) |
| `imul<N>` | `int<N>`, `int<N>` | `int<N>` | multiplication modulo 2^N (signed and unsigned versions are the same op) |
| `idivmod_checked_u<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>, int<M>), #(ErrorType))` | given unsigned integers 0 \<= n \< 2^N, 0 \<= m \< 2^N, generates unsigned q, r where q\*m+r=n, 0\<=r\<m (m=0 is an error) |
| `idivmod_u<N>` | `int<N>`, `int<M>` | `(int<N>, int<M>)` | given unsigned integers 0 \<= n \< 2^N, 0 \<= m \< 2^N, generates unsigned q, r where q\*m+r=n, 0\<=r\<m (m=0 will call panic) |
| `idivmod_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>, int<M>), #(ErrorType))` | given signed integer -2^{N-1} \<= n \< 2^{N-1} and unsigned 0 \<= m \< 2^N, generates signed q and unsigned r where q\*m+r=n, 0\<=r\<m (m=0 is an error) |
| `idivmod_s<N>`( \* ) | `int<N>`, `int<M>` | `(int<N>, int<M>)` | given signed integer -2^{N-1} \<= n \< 2^{N-1} and unsigned 0 \<= m \< 2^N, generates signed q and unsigned r where q\*m+r=n, 0\<=r\<m (m=0 will call panic) |
| `idiv_checked_u<N>` ( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>),#( ErrorType))` | as `idivmod_checked_u` but discarding the second output |
| `idiv_u<N>` | `int<N>`, `int<M>` | `int<N>` | as `idivmod_u` but discarding the second output |
| `imod_checked_u<N>` ( \* ) | `int<N>`, `int<M>` | `Sum(#(int<M>), #(ErrorType))` | as `idivmod_checked_u` but discarding the first output |
| `imod_u<N>` | `int<N>`, `int<M>` | `int<M>` | as `idivmod_u` but discarding the first output |
| `idiv_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>), #(ErrorType))` | as `idivmod_checked_s` but discarding the second output |
| `idiv_s<N>` | `int<N>`, `int<M>` | `int<N>` | as `idivmod_s` but discarding the second output |
| `imod_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<M>), #(ErrorType))` | as `idivmod_checked_s` but discarding the first output |
| `imod_s<N>` | `int<N>`, `int<M>` | `int<M>` | as `idivmod_s` but discarding the first output |
| `iabs<N>` | `int<N>` | `int<N>` | convert signed to unsigned by taking absolute value |
| `iand<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise AND |
| `ior<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise OR |
| `ixor<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise XOR |
| `inot<N>` | `int<N>` | `int<N>` | bitwise NOT |
| `ishl<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | shift first input left by k bits where k is unsigned interpretation of second input (leftmost bits dropped, rightmost bits set to zero) |
| `ishr<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | shift first input right by k bits where k is unsigned interpretation of second input (rightmost bits dropped, leftmost bits set to zero) |
| `irotl<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | rotate first input left by k bits where k is unsigned interpretation of second input (leftmost bits replace rightmost bits) |
| `irotr<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | rotate first input right by k bits where k is unsigned interpretation of second input (rightmost bits replace leftmost bits) |
| `itostring_u<N>` | `int<N>` | `string` | decimal string representation of unsigned integer |
| `itostring_s<N>` | `int<N>` | `string` | decimal string representation of signed integer |
| Name | Inputs | Outputs | Meaning |
|------------------------------|--------------------|----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `imax_u<N>` | `int<N>`, `int<N>` | `int<N>` | maximum of unsigned integers |
| `imax_s<N>` | `int<N>`, `int<N>` | `int<N>` | maximum of signed integers |
| `imin_u<N>` | `int<N>`, `int<N>` | `int<N>` | minimum of unsigned integers |
| `imin_s<N>` | `int<N>`, `int<N>` | `int<N>` | minimum of signed integers |
| `iadd<N>` | `int<N>`, `int<N>` | `int<N>` | addition modulo 2^N (signed and unsigned versions are the same op) |
| `isub<N>` | `int<N>`, `int<N>` | `int<N>` | subtraction modulo 2^N (signed and unsigned versions are the same op) |
| `ineg<N>` | `int<N>` | `int<N>` | negation modulo 2^N (signed and unsigned versions are the same op) |
| `imul<N>` | `int<N>`, `int<N>` | `int<N>` | multiplication modulo 2^N (signed and unsigned versions are the same op) |
| `idivmod_checked_u<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>, int<M>), #(ErrorType))` | given unsigned integers 0 \<= n \< 2^N, 0 \<= m \< 2^N, generates unsigned q, r where q\*m+r=n, 0\<=r\<m (m=0 is an error) |
| `idivmod_u<N>` | `int<N>`, `int<M>` | `(int<N>, int<M>)` | given unsigned integers 0 \<= n \< 2^N, 0 \<= m \< 2^N, generates unsigned q, r where q\*m+r=n, 0\<=r\<m (m=0 will call panic) |
| `idivmod_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>, int<M>), #(ErrorType))` | given signed integer -2^{N-1} \<= n \< 2^{N-1} and unsigned 0 \<= m \< 2^N, generates signed q and unsigned r where q\*m+r=n, 0\<=r\<m (m=0 is an error) |
| `idivmod_s<N>`( \* ) | `int<N>`, `int<M>` | `(int<N>, int<M>)` | given signed integer -2^{N-1} \<= n \< 2^{N-1} and unsigned 0 \<= m \< 2^N, generates signed q and unsigned r where q\*m+r=n, 0\<=r\<m (m=0 will call panic) |
| `idiv_checked_u<N>` ( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>),#( ErrorType))` | as `idivmod_checked_u` but discarding the second output |
| `idiv_u<N>` | `int<N>`, `int<M>` | `int<N>` | as `idivmod_u` but discarding the second output |
| `imod_checked_u<N>` ( \* ) | `int<N>`, `int<M>` | `Sum(#(int<M>), #(ErrorType))` | as `idivmod_checked_u` but discarding the first output |
| `imod_u<N>` | `int<N>`, `int<M>` | `int<M>` | as `idivmod_u` but discarding the first output |
| `idiv_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<N>), #(ErrorType))` | as `idivmod_checked_s` but discarding the second output |
| `idiv_s<N>` | `int<N>`, `int<M>` | `int<N>` | as `idivmod_s` but discarding the second output |
| `imod_checked_s<N>`( \* ) | `int<N>`, `int<M>` | `Sum(#(int<M>), #(ErrorType))` | as `idivmod_checked_s` but discarding the first output |
| `imod_s<N>` | `int<N>`, `int<M>` | `int<M>` | as `idivmod_s` but discarding the first output |
| `iabs<N>` | `int<N>` | `int<N>` | convert signed to unsigned by taking absolute value |
| `iand<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise AND |
| `ior<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise OR |
| `ixor<N>` | `int<N>`, `int<N>` | `int<N>` | bitwise XOR |
| `inot<N>` | `int<N>` | `int<N>` | bitwise NOT |
| `ishl<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | shift first input left by k bits where k is unsigned interpretation of second input (leftmost bits dropped, rightmost bits set to zero) |
| `ishr<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | shift first input right by k bits where k is unsigned interpretation of second input (rightmost bits dropped, leftmost bits set to zero) |
| `irotl<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | rotate first input left by k bits where k is unsigned interpretation of second input (leftmost bits replace rightmost bits) |
| `irotr<N>`( \* ) | `int<N>`, `int<N>` | `int<N>` | rotate first input right by k bits where k is unsigned interpretation of second input (rightmost bits replace leftmost bits) |
| `itostring_u<N>` | `int<N>` | `string` | decimal string representation of unsigned integer |
| `itostring_s<N>` | `int<N>` | `string` | decimal string representation of signed integer |


#### `arithmetic.float.types`

Expand Down

0 comments on commit bc6fba6

Please sign in to comment.