import os.path import struct import numpy as np def createMissingDir(destPath): theDir=os.path.normpath(destPath) if not os.path.exists(theDir): os.makedirs(theDir) # Pack an array of boolean into uint32 def packset(a): b = np.packbits(a) newSize = int(np.ceil(b.shape[0] / 4.0)) * 4 c = np.copy(b) c.resize(newSize) #print(c) vecSize = round(newSize/4) c=c.reshape(vecSize,4) #print(c) r = np.zeros(vecSize) result = [] for i in range(0,vecSize): #print(c[i,:]) #print("%X %X %X %X" % (c[i,0],c[i,1],c[i,2],c[i,3])) d = (c[i,0] << 24) | (c[i,1] << 16) | (c[i,2] << 8) | c[i,3] result.append(d) return(result) def float_to_hex(f): """ Convert and x86 float to an ARM unsigned long int. Args: f (float): value to be converted Raises: Nothing Returns: str : representation of the hex value """ return hex(struct.unpack(' 0x07FFFFFFF): r = 0x07FFFFFFF if (r < -0x080000000): r = -0x080000000 return ("0x%s" % format(struct.unpack(' 0x07FFF): r = 0x07FFF if (r < -0x08000): r = -0x08000 return ("0x%s" % format(struct.unpack(' 0x07F): r = 0x07F if (r < -0x080): r = -0x080 return ("0x%s" % format(struct.unpack('