SHARE
TWEET

Untitled

a guest Jun 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub const fn signum(i: i32) -> i32 {
  2.     (i > 0) as i32 - (i < 0) as i32
  3. }
  4.  
  5. pub fn signum_branch(i: i32) -> i32 {
  6.     match i {
  7.         i if i < 0 => -1,
  8.         0 => 0,
  9.         _ => 1,
  10.     }
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top