prbs lfsr avr code
Using high level programming languages, e, g, C, you would use a long variable for shift register and a constant long XOR mask to generate feedback. That way you'll find the code in literature. Although operation isn't optimized to the limited, the function can be used conveniently without thinking about single bitshifts.
The C shift operation sr <<= 1 is coded by the uP simply as multiple 8-bit RLC operation (rotate left trough carry), which can be easily chained to any wanted bit length, additionally using a storage in memory for shift register, of course. Programming details depend on the respective uP's programming model. When coding in assembler, feedback bits could be evaluated for needed bits explicitely.
Regards,
Frank