def digits_to_int(D,B=10,bigendian=False):
    """
    Convert a list of digits in base B to an integer
    """
    
    n = 0
    p = 1
    
    if bigendian:
        for d in D:
            n += d*p
            p *= B
        
        return n
    
    else:
        for d in reversed(D):
            n += d*p
            p *= B
        
        return n