go does the translation too, 
[https://golang.org/src/os/types.go?s=2790:2823#L55](https://golang.org/src/os/types.go?s=2790:2823#L55)
    
    
        65  func (m FileMode) String() string {
        66      const str = "dalTLDpSugct?"
        67      var buf [32]byte // Mode is uint32.
        68      w := 0
        69      for i, c := range str {
        70              if m&(1<<uint(32-1-i)) != 0 {
        71                      buf[w] = byte(c)
        72                      w++
        73              }
        74      }
        75      if w == 0 {
        76              buf[w] = '-'
        77              w++
        78      }
        79      const rwx = "rwxrwxrwx"
        80      for i, c := range rwx {
        81              if m&(1<<uint(9-1-i)) != 0 {
        82                      buf[w] = byte(c)
        83              } else {
        84                      buf[w] = '-'
        85              }
        86              w++
        87      }
        88      return string(buf[:w])
        89  }
    
    
    Run

Reply via email to