ANSWERS TO EXERCISES

1.3.2. The MMIX Assembly Language

With three exceptions, the exercises of this section haven been revised in Fascicle 1. Here we give solutions to exercises 14, 18, and 22, which are numbered 32, 21, and 29 in Fascicle 1.

[516]

14. The following subroutine has one parameter, the year, and two return values, the day and the month. The printing is left to a driver that is not shown here. A basic implementation is easy to obtain. The following solution uses multiplication instead of division (see exercise 1.3.1´–19), cutting the running time from approximately 337υ down to 122υ. Further improvements are possible. The multiplication by 19 can be achieved in two cycles using 2ADDU and 16ADDU; similarly, multiplication by 7 can ...

Get The MMIX Supplement: Supplement to The Art of Computer Programming Volumes 1, 2, 3 by Donald E. Knuth now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.