negative function Null safety

int negative(
  1. int b
)

negative returns 1 if b < 0 and 0 otherwise.

Implementation

int negative(int b) {
  if (b < 0) {
    return 1;
  } else {
    return 0;
  }
//  return (b >> 31) & 1;
}