Ejemplo n.º 1
0
long addressSetIndex(long address) {
    long setIndexMask = bitMask(sbits);
    long setIndex = address;
    setIndex >>= bbits;
    setIndex &= setIndexMask;
    return setIndex;
}
Ejemplo n.º 2
0
long addressTag(long address) {
    long tagMask = bitMask(ADDRESS_SIZE - (bbits + sbits + 1));
    long tag = address;
    tag >>= (bbits + sbits);
    tag &= tagMask;
    return tag;
}
Ejemplo n.º 3
0
//trying to get good assembler code on this one :)
void generateHardReset(){
  //maydo: DSB before and after the reset
  //lsdigit: 1 worked on stm32, 4 should have worked but looped under the debugger.
  unsigned pattern=0x5FA0005 | (theInterruptController.airc & bitMask(8,3));//retain priority group setting, JIC we don't reset that during startup
  do {//keep on hitting the bit until we reset.
    theInterruptController.airc=pattern;
    //probably should try 5 above in case different vendors misread the arm spec differently.
  } while (1);
}
Ejemplo n.º 4
0
CPLErr LERC_Band::Decompress(buf_mgr &dst, buf_mgr &src)
{
    const Byte *ptr = (Byte *)(src.buffer);
    Lerc2::HeaderInfo hdInfo;
    Lerc2 lerc2;
    if (!lerc2.GetHeaderInfo(ptr, hdInfo))
	return DecompressLERC(dst, src, img);
    // It is lerc2 here
    bool success = false;
    BitMask2 bitMask(img.pagesize.x, img.pagesize.y);
    switch (img.dt) {
#define DECODE(T) success = lerc2.Decode(&ptr, reinterpret_cast<T *>(dst.buffer), bitMask.Bits())
    case GDT_Byte:	DECODE(GByte);	    break;
    case GDT_UInt16:	DECODE(GUInt16);    break;
    case GDT_Int16:	DECODE(GInt16);	    break;
    case GDT_Int32:	DECODE(GInt32);	    break;
    case GDT_UInt32:	DECODE(GUInt32);    break;
    case GDT_Float32:	DECODE(float);	    break;
    case GDT_Float64:	DECODE(double);	    break;
    default:            CPLAssert(FALSE);   break;
#undef DECODE
    }
    if (!success) {
	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during LERC2 decompression");
	return CE_Failure;
    }
    if (!img.hasNoData)
	return CE_None;

    // Fill in no data values
    switch (img.dt) {
#define UNMASK(T) UnMask(bitMask, reinterpret_cast<T *>(dst.buffer), img)
    case GDT_Byte:	UNMASK(GByte);	    break;
    case GDT_UInt16:	UNMASK(GUInt16);    break;
    case GDT_Int16:	UNMASK(GInt16);	    break;
    case GDT_Int32:	UNMASK(GInt32);	    break;
    case GDT_UInt32:	UNMASK(GUInt32);    break;
    case GDT_Float32:	UNMASK(float);	    break;
    case GDT_Float64:	UNMASK(double);	    break;
    default:            CPLAssert(FALSE);   break;
#undef DECODE
    }
    return CE_None;
}
Ejemplo n.º 5
0
 void disableInterrupt(unsigned irqnum){
   ControlWord(Irq::biasFor(irqnum)|0x180)=bitMask(Irq::bitFor(irqnum));
 }
Ejemplo n.º 6
0
long addressBlockOffset(long address) {
    long blockOffsetMask = bitMask(bbits);
    long blockOffset = address;
    blockOffset &= blockOffsetMask;
    return blockOffset;
}