
def unsigned_1(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    

    return total
            

def unsigned_2(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)

    return total
            

def unsigned_3(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)

    return total
            

def unsigned_4(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)

    return total
            

def signed_1(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    

    # Convert to signed
    if total >= 128:
        total -= 256

    return total
           

def signed_2(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)

    # Convert to signed
    if total >= 32768:
        total -= 65536

    return total
           

def signed_3(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)

    # Convert to signed
    if total >= 8388608:
        total -= 16777216

    return total
           

def signed_4(stream):
    # This function generated by genstream.py
    # **** do not edit it directly! ****
    total = next(stream)
    
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)
    total *= 256
    total += next(stream)

    # Convert to signed
    if total >= 2147483648:
        total -= 4294967296

    return total
           
