C programming hint
Lum Johnson
lum at osu-eddie.UUCP
Sat Jul 20 01:18:43 AEST 1985
In article <913 at teddy.UUCP> kps at teddy.UUCP writes:
>
> char blanks[SIZE];
> blanks[0] = ' ';
> strncpy(blanks + 1, blanks, SIZE - 1); /* initialize entire array */
>
> ... I've been bludgeoned to death with the fact that my method is
> implementation dependent and that it won't work all the time.
This actually works in assembly language for the PDP-10.
movei t1," " ; put <SPACE> in reg
movem t1,blanks ; deposit char in buffer
move t1,[blanks,,blanks+1] ; control register for blt
blt t1,blanks+size ; propagate char over buffer
The BLT iterates the copy-previous-char operation (specified in t1),
incrementing both halves of the control register (t1) until
blanks+size is reached.
Lum Johnson ..!cbosgd!osu-eddie!lum or lum at osu-eddie.uucp
More information about the Comp.lang.c
mailing list