about summary refs log blame commit diff stats
path: root/linux/407right-justify.mu
blob: aa767782c42d2762b3ffd71349a6f82eff317107 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                                                   
                                     

                                        
   
                          
               
                                            
                      



                               
# print 'n' with enough leading spaces to be right-justified in 'width'
fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: int {
  # tweak things for negative numbers
  var n-width/eax: int <- decimal-size n
  var width/ecx: int <- copy _width
  {
    compare n-width, width
    break-if->=
    print-code-point-utf8 screen, 0x20/space
    width <- decrement
    loop
  }
  print-int32-decimal screen, n
}