Returns 1 where signed number is negative, and 0 elsewhere.
(binary_num: Node)
| 348 | |
| 349 | // Returns 1 where signed number is negative, and 0 elsewhere. |
| 350 | fn is_negative(binary_num: Node) -> Result<Node> { |
| 351 | binary_num.get_slice(vec![ |
| 352 | SliceElement::Ellipsis, |
| 353 | SliceElement::SubArray(Some(-1), None, None), |
| 354 | ]) |
| 355 | } |
| 356 | |
| 357 | // Returns (is_negative(binary_num), abs(binary_num)). |
| 358 | fn abs(binary_num: Node, is_signed: bool) -> Result<(Node, Node)> { |