Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

23 righe
499 B

  1. // Copyright 2009 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build plan9
  5. package plan9
  6. func itoa(val int) string { // do it here rather than with fmt to avoid dependency
  7. if val < 0 {
  8. return "-" + itoa(-val)
  9. }
  10. var buf [32]byte // big enough for int64
  11. i := len(buf) - 1
  12. for val >= 10 {
  13. buf[i] = byte(val%10 + '0')
  14. i--
  15. val /= 10
  16. }
  17. buf[i] = byte(val + '0')
  18. return string(buf[i:])
  19. }