def conv_8upto16(val, nb):
    """ converts val (8bits) to 8+n bits (n must be comprised between 0 & 8 bits)
    :warning: conversion output shall not exceed 16bits (input shall strictly be unsigned 8bits)
    :warning: nb shall be in range 0-8 (note that using 0 doesn't change val)
    :param val: 8b var to convert
    :param nb: nb of bit pseudo shifts to add
    :return: 8+n bits conversion result """
    return ((val << nb) + (val & (0xFF >> (8 - nb)))) & 0xFFFF