INLINE void SET_CONDITION_CODES(m68ki_cpu_core *m68k, fp_reg reg) { REG_FPSR &= ~(FPCC_N|FPCC_Z|FPCC_I|FPCC_NAN); // sign flag if (reg.i & U64(0x8000000000000000)) { REG_FPSR |= FPCC_N; } // zero flag if ((reg.i & U64(0x7fffffffffffffff)) == 0) { REG_FPSR |= FPCC_Z; } // infinity flag if ((reg.i & U64(0x7fffffffffffffff)) == DOUBLE_INFINITY) { REG_FPSR |= FPCC_I; } // NaN flag if (((reg.i & DOUBLE_EXPONENT) == DOUBLE_EXPONENT) && ((reg.i & DOUBLE_MANTISSA) != 0)) { REG_FPSR |= FPCC_NAN; } }
static WRITE64_HANDLER(reset_w) { if (!(mem_mask & U64(0xffffffff00000000))) { if (data & U64(0x100000000)) { cpunum_set_input_line(0, INPUT_LINE_RESET, PULSE_LINE); unk3 = 0; } } }
// Hash key of the FEN Key Zob::compute_fen_key (const string &fen, bool c960) const { if (fen.empty ()) return U64 (0); Key fen_key = U64 (0); File king[CLR_NO] = {F_NO}; istringstream sfen (fen); uint8_t ch; sfen >> noskipws; uint32_t idx; Square s = SQ_A8; while ((sfen >> ch) && !isspace (ch)) { if (isdigit (ch)) { s += Delta (ch - '0'); // Advance the given number of files } else if (isalpha (ch) && (idx = CharPiece.find (ch)) != string::npos) { Piece p = Piece (idx); fen_key ^= _.psq_k[_color (p)][_ptype (p)][s]; ++s; } else if (ch == '/') { s += DEL_SS; } } sfen >> ch; if ('w' == ch) fen_key ^= _.mover_side; sfen >> ch; if (c960) { while ((sfen >> ch) && !isspace (ch)) { Color c = isupper (ch) ? WHITE : BLACK; uint8_t sym = tolower (ch); if ('a' <= sym && sym <= 'h') { fen_key ^= _.castle_right[c][(king[c] < to_file (sym)) ? CS_K : CS_Q]; } else { return U64 (0); } } } else { while ((sfen >> ch) && !isspace (ch))
UINT64 read_uint64(FILE *infile) { UINT64 res0 = U64(0), res1 = U64(0); UINT64 res; unsigned char buffer[8]; fread(buffer, 8, 1, infile); res0 = buffer[3] | buffer[2]<<8 | buffer[1]<<16 | buffer[0]<<24; res1 = buffer[7] | buffer[6]<<8 | buffer[5]<<16 | buffer[4]<<24; res = res0<<32 | res1; return res; }
bool FInitHashe(PCON pcon) { if( hashBuffer ) { free( hashBuffer ); hashBuffer = 0; } s_chashdMac = 15; int cbMaxHash = uciHash.get_spin(); if( cbMaxHash <= 0 || cbMaxHash > 1024 ) cbMaxHash = 32; cbMaxHash *= 1024*1024; chashdMax = 1; for (;;) { if (chashdMax * 2 * (int)sizeof(HASHD) > cbMaxHash) break; chashdMax *= 2; } VPrSendComment("%d Kbytes main hash memory (%d entries)", chashdMax * sizeof(HASHD) / 1024, chashdMax); Assert( sizeof(HASHD) == 16 ); hashBuffer = (RGHASHD) malloc( 64 + chashdMax * sizeof(HASHD)); if ( hashBuffer == NULL) { VPrSendComment("Can't allocate hash memory: %d bytes", chashdMax * sizeof(HASHD)); return false; } s_rghashd = (RGHASHD) ((U64(hashBuffer)+63) & (~63)); s_chashdMac = ((chashdMax / BUCKET_SIZE) - 1) * BUCKET_SIZE; stats.Hsize = chashdMax; VClearHashe(); return true; }
// ================================================================================================ // Static method that needs to be called before any timing can be done // ================================================================================================ void Timer::StaticInit() { #ifdef __MACH__ mach_timebase_info_data_t info; mach_timebase_info(&info); sFreq = U64(1000000000.0 * F64(info.denom) / F64(info.numer) + 0.5); #endif }
static READ64_HANDLER(unk4_r) { UINT64 r = 0; logerror("unk4_r: %08X, %08X%08X at %08X\n", offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), activecpu_get_pc()); if (!(mem_mask & U64(0xffffffff00000000))) { // MCfg r |= (UINT64)((0 << 13) | (5 << 10)) << 32; } if (!(mem_mask & U64(0x00000000ffffffff))) { r |= unk20004; } return r; }
void Statistics::accumulateDistance(F32 dist) { // We'll track distance as an integer to avoid data loss due to a small float being added to a big one. // Not that precision is important; it isn't... but rather to avoid appearance of "going no further" once // you've gone a certain distance. mDist += U64(dist * DIST_MULTIPLIER); }
U64 IRAnalyzer::DecodeAddr(U64 sample, U8 j, IRAnalyzerResults::TypeFrame type) { U8 addr = 0xFF; U64 ntick, mtick, first, tt; first = sample; tt = sample; for( U8 i=0; i<j; i++ ) { mSerial->AdvanceToNextEdge(); ntick = mSerial->GetSampleNumber(); mtick = U64((ntick - tt)*1000000/mSampleRateHz); if (mtick > 400 && mtick < 700) { addr ^= (1 << (7-i)); } mSerial->AdvanceToNextEdge(); tt = mSerial->GetSampleNumber(); } Frame frame; frame.mData1 = j | type; frame.mData2 = reverse(addr); frame.mFlags = 0; frame.mStartingSampleInclusive = first; frame.mEndingSampleInclusive = tt; mResults->AddFrame( frame ); mResults->CommitResults(); ReportProgress( frame.mEndingSampleInclusive ); return tt; }
/** * brief: * * @returns */ void RespProcessor::doIt() { char buffer[16*1024] = {'\0'}; ResponseManager* pRespMgr = ResponseManager::getInstance(); assert(NULL != pRespMgr); while(true) { CmdTask resp; bool ret = pRespMgr->getRespTask(resp); if(!ret) { LOG4CPLUS_WARN(CLogger::logger, "response array is empty."); continue; } SessionBase* pSession = _sess_mgr_prt->getSession(resp.seqno); if(NULL == pSession) { LOG4CPLUS_ERROR(CLogger::logger, "can't find the session by " << resp.seqno); delete resp.pCmd; resp.pCmd = NULL; continue; } int64_t uid = resp.pCmd->get_userid(); string name = resp.pCmd->get_cmd_name(); memset(buffer, '\0', 16 * 1024); int length = resp.pCmd->header_length() + resp.pCmd->body_length(); ret = resp.pCmd->encode((byte*)buffer, length); resp.releaseCmd(); if(!ret) { LOG4CPLUS_ERROR(CLogger::logger, "command encode failed for " << name); continue; } pSession->write2Send(string(buffer, length)); int iret = pSession->sendBuffer(); uint64_t data = U64(resp.seqno, pSession->getFd()); if(SOCKET_EAGAIN == iret) //socket»º³åÇøдÂú { _epoll_svr_ptr->notify(pSession->getFd(), data, EVENT_WRITE); } else if(SOCKET_ERR == iret) //socket ³ö´í { _epoll_svr_ptr->notify(pSession->getFd(), data, EVENT_ERROR); _sess_mgr_prt->freeSession(pSession); _client_mgr_prt->freeClient(uid, resp.seqno); } LOG4CPLUS_INFO(CDebugLogger::logger, "TimeTace: request[" << resp.idx << "] to response[" << name << "] spend time " << current_time_usec() - resp.timestamp); Index::free(resp.idx); } }
static READ64_HANDLER(unk2_r) { if (!(mem_mask & U64(0xffffffff00000000))) { return (UINT64)0xa5 << 32; } return 0; }
static READ64_HANDLER(unk4_r) { if (!(mem_mask & U64(0xffffffff00000000))) { return ((UINT64)0 << (13+32)) | ((UINT64)5 << (10+32)); } return 0; }
INLINE floatx80 propagateFloatx80NaNOneArg(floatx80 a) { if (floatx80_is_signaling_nan(a)) float_raise(float_flag_invalid); a.low |= U64(0xC000000000000000); return a; }
U64 LLFastTimer::countsPerSecond() { if (!sCPUClockFrequency) { CProcessor proc; sCPUClockFrequency = proc.GetCPUFrequency(50); } return U64(sCPUClockFrequency); }
uint32_t scudsp_cpu_device::scudsp_get_source_mem_reg_value( uint32_t mode ) { if ( mode < 0x8 ) { return scudsp_get_source_mem_value( mode ); } else { switch( mode ) { case 0x9: return (uint32_t)((m_alu & U64(0x00000000ffffffff)) >> 0); case 0xA: return (uint32_t)((m_alu & U64(0x0000ffffffff0000)) >> 16); } } return 0; }
static void FreeFilter(ALCdevice *device, ALfilter *filter) { ALuint id = filter->id - 1; ALsizei lidx = id >> 6; ALsizei slidx = id & 0x3f; memset(filter, 0, sizeof(*filter)); VECTOR_ELEM(device->FilterList, lidx).FreeMask |= U64(1) << slidx; }
static void FreeEffect(ALCdevice *device, ALeffect *effect) { ALuint id = effect->id - 1; ALsizei lidx = id >> 6; ALsizei slidx = id & 0x3f; memset(effect, 0, sizeof(*effect)); VECTOR_ELEM(device->EffectList, lidx).FreeMask |= U64(1) << slidx; }
// UNIX system only U64 CudaCompiler::getFileTimeStamp(std::string &file) { struct stat fileStat; if (0 != stat( file.c_str(), &fileStat)) { return 0; } time_t lastModif = fileStat.st_mtime; return U64(lastModif); }
static READ64_HANDLER(irq_enable_r) { UINT64 r = 0; if (!(mem_mask & U64(0xffffffff00000000))) { r |= (UINT64)(irq_enable) << 32; } return r; }
// this accepts only 32-bit accesses INLINE int decode_reg32_64(running_machine *machine, UINT32 offset, UINT64 mem_mask, UINT64 *shift) { int reg = offset * 2; *shift = 0; // non 32-bit accesses have not yet been seen here, we need to know when they are if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) { mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine)); // debugger_break(machine); } if (mem_mask == U64(0xffffffff00000000)) { reg++; *shift = 32; } return reg; }
// this accepts only 32-bit accesses int dc_state::decode_reg32_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift) { int reg = offset * 2; *shift = 0; // non 32-bit accesses have not yet been seen here, we need to know when they are if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) { osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context()); //machine().debug_break(); } if (mem_mask == U64(0xffffffff00000000)) { reg++; *shift = 32; } return reg; }
static void send_info() { int min_depth; if(option_get_bool(Option,"WbWorkArounds2")){ // Silly bug in some versions of WinBoard. // depth <=1 clears the engine output window. // Why shouldn't an engine be allowed to send info at depth 1? min_depth=2; }else{ min_depth=1; } gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth>min_depth?Uci->best_depth:min_depth, 0,0.0,U64(0),Uci->info); }
// this accepts only 32 and 16 bit accesses int dc_state::decode_reg3216_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift) { int reg = offset * 2; *shift = 0; // non 16&32-bit accesses have not yet been seen here, we need to know when they are if ((mem_mask != U64(0x0000ffff00000000)) && (mem_mask != U64(0x000000000000ffff)) && (mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) { osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context()); //machine().debug_break(); } if (ACCESSING_BITS_32_47) { reg++; *shift = 32; } return reg; }
static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) { EffectSubList *sublist; ALuint lidx = (id-1) >> 6; ALsizei slidx = (id-1) & 0x3f; if(UNLIKELY(lidx >= VECTOR_SIZE(device->EffectList))) return NULL; sublist = &VECTOR_ELEM(device->EffectList, lidx); if(UNLIKELY(sublist->FreeMask & (U64(1)<<slidx))) return NULL; return sublist->Effects + slidx; }
static READ64_HANDLER(dsp_r) { UINT64 r = 0; if (offset == 0x7fe) { if (!(mem_mask & U64(0xffffffff00000000))) { r |= (UINT64)(dsp_value) << 32; } } return r; }
bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const { LLInventoryType::EType object_type = item->getInventoryType(); const LLUUID object_id = item->getUUID(); const U32 filterTypes = mFilterOps.mFilterTypes; //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_OBJECT // Pass if this item's type is of the correct filter type if (filterTypes & FILTERTYPE_OBJECT) { // If it has no type, pass it, unless it's a link. if (object_type == LLInventoryType::IT_NONE) { if (item && item->getIsLinkType()) { return false; } } else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0)) { return false; } } //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_UUID // Pass if this item is the target UUID or if it links to the target UUID if (filterTypes & FILTERTYPE_UUID) { if (!item) return false; if (item->getLinkedUUID() != mFilterOps.mFilterUUID) return false; } //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_DATE // Pass if this item is within the date range. if (filterTypes & FILTERTYPE_DATE) { // We don't get the updated item creation date for the task inventory or // a notecard embedded item. See LLTaskInvFVBridge::getCreationDate(). return false; } return true; }
static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b) { int aIsNaN = floatx80_is_nan(a); int aIsSignalingNaN = floatx80_is_signaling_nan(a); int bIsNaN = floatx80_is_nan(b); int bIsSignalingNaN = floatx80_is_signaling_nan(b); a.low |= U64(0xC000000000000000); b.low |= U64(0xC000000000000000); if (aIsSignalingNaN | bIsSignalingNaN) float_raise(float_flag_invalid); if (aIsSignalingNaN) { if (bIsSignalingNaN) goto returnLargerSignificand; return bIsNaN ? b : a; } else if (aIsNaN) { if (bIsSignalingNaN | ! bIsNaN) return a; returnLargerSignificand: if (a.low < b.low) return b; if (b.low < a.low) return a; return (a.high < b.high) ? a : b; } else { return b; } }
U64 QPosition::WhitePawnMovement(const U64& location) const{ // check the single space infront of the white pawn const U64 one_step = (location << 8 ) & ~occupancy; // for all moves that came from rank 2 (home row) and passed the above filter, // thereby being on rank 3, check and see if I can move forward one more const U64 two_steps = ((one_step & MaskRank[RANK_3]) << 8) & ~occupancy; // the union of the movements dictate the possible moves forward available const U64 valid_steps = one_step | two_steps; // next we calculate the pawn attacks // check the left side of the pawn, minding the underflow File A const U64 left_attack = (location & ClearFile[FILE_A]) << 7; const U64 right_attack = (location & ClearFile[FILE_H]) << 9; const U64 valid_attacks = (left_attack | right_attack) & boccupancy; return U64(valid_steps | valid_attacks); }
U64 QPosition::KnightMovement(const U64& location, const U64& own_side) const{ const U64 clearAB = ClearFile[FILE_A] & ClearFile[FILE_B]; const U64 clearGH = ClearFile[FILE_G] & ClearFile[FILE_H]; const U64 spot1 = (location & clearAB) << 6; const U64 spot2 = (location & ClearFile[FILE_A]) << 15; const U64 spot3 = (location & ClearFile[FILE_H]) << 17; const U64 spot4 = (location & clearGH) << 10; const U64 spot5 = (location & clearGH) >> 6; const U64 spot6 = (location & ClearFile[FILE_H]) >> 15; const U64 spot7 = (location & ClearFile[FILE_A]) >> 17; const U64 spot8 = (location & clearAB) >> 10; const U64 moves = spot1 | spot2 | spot3 | spot4 | spot5 | spot6 | spot7 | spot8; return U64(moves & ~own_side); }
bool ClientPuzzleManager::NonceTable::checkAdd(Nonce &theNonce) { U32 nonce1 = readU32FromBuffer(theNonce.data); U32 nonce2 = readU32FromBuffer(theNonce.data + 4); U64 fullNonce = (U64(nonce1) << 32) | nonce2; U32 hashIndex = U32(fullNonce % mHashTableSize); for(Entry *walk = mHashTable[hashIndex]; walk; walk = walk->mHashNext) if(walk->mNonce == theNonce) return false; Entry *newEntry = (Entry *) mChunker.alloc(sizeof(Entry)); newEntry->mNonce = theNonce; newEntry->mHashNext = mHashTable[hashIndex]; mHashTable[hashIndex] = newEntry; return true; }