Logo Search packages:      
Sourcecode: libnl version File versions  Download package

double nl_cancel_down_bits ( unsigned long long  l,
char **  unit 
)

Cancel down a bit counter

  • l bit counter
  • unit destination unit pointer
Cancels downa bit counter until it reaches a reasonable unit. The chosen unit is assigned to unit.

Returns:
The cancelled down bit counter in the new unit.

Definition at line 132 of file utils.c.

{
      if (l >= 1099511627776ULL) {
            *unit = "Tbit";
            return ((double) l) / 1099511627776ULL;
      } else if (l >= 1073741824) {
            *unit = "Gbit";
            return ((double) l) / 1073741824;
      } else if (l >= 1048576) {
            *unit = "Mbit";
            return ((double) l) / 1048576;
      } else if (l >= 1024) {
            *unit = "Kbit";
            return ((double) l) / 1024;
      } else {
            *unit = "bit";
            return (double) l;
      }
            
}


Generated by  Doxygen 1.6.0   Back to index