#NEWLINE# def int_to_words( int_val , word_size , num_words ) : #NEWLINE# #INDENT# '\n    :param int_val: Unsigned integer to be divided into words of equal size.\n\n    :param word_size: Width (in bits) of each unsigned integer word value.\n\n    :param num_words: Number of unsigned integer words expected.\n\n    :return: A tuple contain unsigned integer word values split according\n        to provided arguments.\n    ' #NEWLINE# max_int = ( ( 2 ** ( num_words * word_size ) ) - 1 ) #NEWLINE# if ( not ( 0 <= num_words <= max_int ) ) : #NEWLINE# #INDENT# raise IndexError ( ( 'integer out of bounds: %r!' % hex ( int_val ) ) ) #NEWLINE# #UNINDENT# max_word = ( ( 2 ** word_size ) - 1 ) #NEWLINE# words = [ ] #NEWLINE# for _ in range ( num_words ) : #NEWLINE# #INDENT# word = ( int_val & max_word ) #NEWLINE# words . append ( int ( word ) ) #NEWLINE# int_val >>= word_size #NEWLINE# #UNINDENT# return tuple ( reversed ( words ) )