previous | contents | next

Fig. OC-5. RTM diagram to count the number of ones in a word, modulo 2 (i.e. parity), holding result within the control part.

Figure OC-5 gives an RTM diagram for a considerably faster method. Also note that only one register, A, is used for word W (at entry) and the result, Count (at exit). This method uses the flowchart to hold data; in this case, the location of the control within two loops indicates whether an odd or even number of ones have been detected. At the exit Count is either 0 or 1.

85

previous | contents | next