Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5.  
  6. die "Usage: makefixed.pl <value>\n" if (@ARGV != 1);
  7.  
  8. my $val = shift @ARGV;
  9.  
  10. $val *= (1 << 10);
  11.  
  12. # Round away from zero
  13. if ($val < 0) {
  14.         $val -= 0.5;
  15. } else {
  16.         $val += 0.5;
  17. }
  18.  
  19. # Truncates back towards zero
  20. printf("0x%.8x\n", $val);
  21.  
  22.