summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-02-25 16:13:13 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-02-25 16:16:51 (GMT)
commit7a5748839ae51d632ea519c921f1a87b8c19c864 (patch)
tree9a085ef84f95df7d5670146eb0647f9ffc62b7a7
parent8611195cb485afe80e7e32f36b3ea4cc35b41c23 (diff)
downloadvirtio9p-7a5748839ae51d632ea519c921f1a87b8c19c864.zip
virtio9p-7a5748839ae51d632ea519c921f1a87b8c19c864.tar.gz
virtio9p-7a5748839ae51d632ea519c921f1a87b8c19c864.tar.bz2
virtio9p-7a5748839ae51d632ea519c921f1a87b8c19c864.tar.xz
datetime: shave a few more bytes by using the AAM instruction
AAM is 8/8->8 unsigned division with an immediate divisor; specifically it is AL/imm8 -> AH with the remainder in AL.
-rw-r--r--datetime.S10
1 files changed, 5 insertions, 5 deletions
diff --git a/datetime.S b/datetime.S
index 690e659..63534e9 100644
--- a/datetime.S
+++ b/datetime.S
@@ -99,15 +99,15 @@ unix2dos:
addw %ax,%bx /* Add, not or! May be modifying the year! */
xchgw %dx,%ax
- cwtd
- movb $5,%cl
- divw %cx
+ aam $5
+ addb %ah,%bl
+ xchgw %bx,%ax
incw %ax /* Day of month is 1-based */
- addw %bx,%ax /* Day in month, shift everything to %ax */
4:
+ /* Here %ax has the date component and %si the time component */
shll $16,%eax
- movw %si,%ax
+ xchgw %si,%ax
popw %si
popw %bx