Replace hexprint with a version that is much faster for values > 15.

Since I managed to commit my alternate scheme for zeropad, delete
the commented out lines and replace the only other use.
I've not deleted the function itself though.
This commit is contained in:
dsl 2007-03-09 19:16:47 +00:00
parent 814e248430
commit b1c0dd5ffc
2 changed files with 12 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh - #!/bin/sh -
# $NetBSD: MAKEDEV.tmpl,v 1.80 2007/03/09 13:57:54 dsl Exp $ # $NetBSD: MAKEDEV.tmpl,v 1.81 2007/03/09 19:16:47 dsl Exp $
# #
# Copyright (c) 2003,2007 The NetBSD Foundation, Inc. # Copyright (c) 2003,2007 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -340,16 +340,14 @@ zeropad()
# #
hexprint() hexprint()
{ {
case $1 in val="$(($1 + 0))"
[0-9]) echo $1 ;; hex=
10) echo a ;; set -- 0 1 2 3 4 5 6 7 8 9 a b c d e f
11) echo b ;; while [ "$val" -gt 0 ]; do
12) echo c ;; eval hex=\$$(($val % 16 + 1))\$hex
13) echo d ;; val="$(($val / 16))"
14) echo e ;; done
15) echo f ;; echo "${hex:-0}"
*) echo $(hexprint $(($1 / 16)))$(hexprint $(($1 % 16))) ;;
esac
} }
setup() setup()
@ -791,7 +789,6 @@ ttyCY*)
eminor=$(($minor + $off)) eminor=$(($minor + $off))
while [ $minor -lt $eminor ] while [ $minor -lt $eminor ]
do do
# nminor=$(zeropad 3 $minor)
nminor=000$minor nminor=000$minor
nminor=${nminor#${nminor%???}} nminor=${nminor#${nminor%???}}
mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
@ -807,7 +804,6 @@ ttyCZ*)
eminor=$(($minor + $off)) eminor=$(($minor + $off))
while [ $minor -lt $eminor ] while [ $minor -lt $eminor ]
do do
# nminor=$(zeropad 4 $minor)
nminor=0000$minor nminor=0000$minor
nminor=${nminor#${nminor%????}} nminor=${nminor#${nminor%????}}
mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
@ -830,7 +826,6 @@ tty[0-9]|tty0[0-9])
tty0*|tty1*|tty[0-9]) tty0*|tty1*|tty[0-9])
unit=${i#tty} unit=${i#tty}
# ounit=$(zeropad 2 $unit)
ounit=00$unit ounit=00$unit
ounit=${ounit#${ounit%??}} ounit=${ounit#${ounit%??}}
mkdev tty$ounit c %com_chr% $(($unit + $dialin )) "" "" $u_uucp mkdev tty$ounit c %com_chr% $(($unit + $dialin )) "" "" $u_uucp

View File

@ -1,4 +1,4 @@
# $NetBSD: MAKEDEV.conf,v 1.10 2007/01/15 23:35:12 hubertf Exp $ # $NetBSD: MAKEDEV.conf,v 1.11 2007/03/09 19:16:48 dsl Exp $
all_md) all_md)
makedev mt0 mt1 ts0 ts1 st0 st1 uk0 ss0 cd0 vt0 makedev mt0 mt1 ts0 ts1 st0 st1 uk0 ss0 cd0 vt0
@ -96,7 +96,8 @@ dz*)
while [ $i -lt 8 ] while [ $i -lt 8 ]
do do
oi=$(($unit * 8 + $i)) oi=$(($unit * 8 + $i))
zoi=$(zeropad 2 $oi) zoi=00$oi
zoi=${zoi#${zoi%??}}
mkdev tty$zoi c 1 $oi mkdev tty$zoi c 1 $oi
i=$(($i + 1)) i=$(($i + 1))
done done