static void get_runstate_snapshot(struct vcpu_runstate_info *res) { u64 state_time; struct vcpu_runstate_info *state; BUG_ON(preemptible()); state = &__get_cpu_var(xen_runstate); do { state_time = get64(&state->state_entry_time); barrier(); *res = *state; barrier(); } while (get64(&state->state_entry_time) != state_time); }
static unsigned long long getboxlen(const u_char *ptr) { unsigned value = get32(ptr); if ( value == 1 ) { return get64(ptr + 8); } return value; }
uint32_t sftp_parse_uint64(struct sftpjob *job, uint64_t *ur) { if(job->left < 8) return SSH_FX_BAD_MESSAGE; *ur = get64(job->ptr); job->ptr += 8; job->left -= 8; return SSH_FX_OK; }
/* do_seek for stdio xfiles */ static afs_uint32 xf_FILE_do_seek(XFILE * X, dt_uint64 * offset) { FILE *F = X->refcon; off_t where = get64(*offset); if (fseek(F, where, SEEK_SET) == -1) return errno; return 0; }
/* * Runstate accounting */ static void get_runstate_snapshot(struct vcpu_runstate_info *res) { u64 state_time; struct vcpu_runstate_info *state; BUG_ON(preemptible()); state = this_cpu_ptr(&xen_runstate); /* * The runstate info is always updated by the hypervisor on * the current CPU, so there's no need to use anything * stronger than a compiler barrier when fetching it. */ do { state_time = get64(&state->state_entry_time); barrier(); *res = *state; barrier(); } while (get64(&state->state_entry_time) != state_time); }
/** \internal * * Decodes the CBOR integer value when it is larger than the 16 bits available * in value->extra. This function requires that value->flags have the * CborIteratorFlag_IntegerValueTooLarge flag set. * * This function is also used to extract single- and double-precision floating * point values (SinglePrecisionFloat == Value32Bit and DoublePrecisionFloat == * Value64Bit). */ uint64_t _cbor_value_decode_int64_internal(const CborValue *value) { assert(value->flags & CborIteratorFlag_IntegerValueTooLarge || value->type == CborFloatType || value->type == CborDoubleType); // since the additional information can only be Value32Bit or Value64Bit, // we just need to test for the one bit those two options differ assert((*value->ptr & SmallValueMask) == Value32Bit || (*value->ptr & SmallValueMask) == Value64Bit); if ((*value->ptr & 1) == (Value32Bit & 1)) return get32(value->ptr + 1); assert((*value->ptr & SmallValueMask) == Value64Bit); return get64(value->ptr + 1); }
/* * Function: grain_keystream * * Synopsis * Generates a new bit and updates the internal state of the cipher. */ u8 grain_keystream(ECRYPT_ctx* ctx) { u32 x0 = get3(S), x1 = get25(S), x2 = get46(S), x3 = get64(S), x4 = get63(B); u32 Z = get1(B) ^ get2(B) ^ get4(B) ^ get10(B) ^ get31(B) ^ get43(B) ^ get56(B) ^ h(x0,x1,x2,x3,x4); u32 S80 = get62(S) ^ get51(S) ^ get38(S) ^ get23(S) ^ get13(S) ^ get0(S); #if !defined(COMBINE_TERMS) u32 B80 =(get0(S)) ^ (get62(B)) ^ (get60(B)) ^ (get52(B)) ^ (get45(B)) ^ (get37(B)) ^ (get33(B)) ^ (get28(B)) ^ (get21(B))^ (get14(B)) ^ (get9(B)) ^ (get0(B)) ^ (get63(B)&get60(B)) ^ (get37(B)&get33(B)) ^ (get15(B)&get9(B))^ (get60(B)&get52(B)&get45(B)) ^ (get33(B)&get28(B)&get21(B)) ^ (get63(B)&get45(B)&get28(B)&get9(B))^ (get60(B)&get52(B)&get37(B)&get33(B)) ^ (get63(B)&get60(B)&get21(B)&get15(B))^ (get63(B)&get60(B)&get52(B)&get45(B)&get37(B)) ^ (get33(B)&get28(B)&get21(B)&get15(B)&get9(B))^ (get52(B)&get45(B)&get37(B)&get33(B)&get28(B)&get21(B)); #else u32 B33_28_21 = (get33(B)&get28(B)&get21(B)); /* 3 */ u32 B52_45_37 = (get52(B)&get45(B)&get37(B)); /* 2 */ u32 B52_37_33 = (get52(B)&get37(B)&get33(B)); /* 2 */ u32 B60_52_45 = (get60(B)&get52(B)&get45(B)); /* 2 */ u32 B63_60 = (get63(B)&get60(B)); /* 3 */ u32 B37_33 = (get37(B)&get33(B)); /* 3 */ u32 B45_28 = (get45(B)&get28(B)); /* 2 */ u32 B15_9 = (get15(B)&get9(B)); /* 2 */ u32 B21_15 = (get21(B)&get15(B)); /* 2 */ u32 B80 =(get0(S)) ^ (get62(B)) ^ (get60(B)) ^ (get52(B)) ^ (get45(B)) ^ (get37(B)) ^ (get33(B)) ^ (get28(B)) ^ (get21(B))^ (get14(B)) ^ (get9(B)) ^ (get0(B)) ^ (B63_60) ^ (B37_33) ^ (B15_9)^ (B60_52_45) ^ (B33_28_21) ^ (get63(B)&B45_28&get9(B))^ (get60(B)&B52_37_33) ^ (B63_60&B21_15)^ (B63_60&B52_45_37) ^ (B33_28_21&B15_9)^ (B52_45_37&B33_28_21); #endif SHIFT_FSR(S); SHIFT_FSR(B); set79(S,S80); set79(B,B80); return Z&1; }
static int longsigsizeTag(Header h, rpmtd td, headerGetFlags hgflags) { return get64(h, td, RPMTAG_LONGSIGSIZE, RPMTAG_SIGSIZE); }
static int longarchivesizeTag(Header h, rpmtd td, headerGetFlags hgflags) { return get64(h, td, RPMTAG_LONGARCHIVESIZE, RPMTAG_ARCHIVESIZE); }
/** * Retrieve file sizes as 64bit regardless of how they're stored. * @param h header * @retval td tag data container * @param hgflags header get flags * @return 1 on success */ static int longfilesizesTag(Header h, rpmtd td, headerGetFlags hgflags) { return get64(h, td, RPMTAG_LONGFILESIZES, RPMTAG_FILESIZES); }
uintptr_t getP(pint_t addr) { if (sizeof(uintptr_t) == sizeof(uint32_t)) return get32(addr); else return get64(addr); }
pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding, const unw_proc_info_t *ctx) { pint_t startAddr = addr; const uint8_t *p = (uint8_t *)addr; pint_t result; if (encoding == DW_EH_PE_omit) return 0; if (encoding == DW_EH_PE_aligned) { addr = (addr + sizeof(pint_t) - 1) & sizeof(pint_t); return getP(addr); } // first get value switch (encoding & 0x0F) { case DW_EH_PE_ptr: result = getP(addr); p += sizeof(pint_t); addr = (pint_t)p; break; case DW_EH_PE_uleb128: result = getULEB128(addr, end); break; case DW_EH_PE_udata2: result = get16(addr); p += 2; addr = (pint_t)p; break; case DW_EH_PE_udata4: result = get32(addr); p += 4; addr = (pint_t)p; break; case DW_EH_PE_udata8: result = get64(addr); p += 8; addr = (pint_t)p; break; case DW_EH_PE_sleb128: result = getSLEB128(addr, end); break; case DW_EH_PE_sdata2: result = (int16_t)get16(addr); p += 2; addr = (pint_t)p; break; case DW_EH_PE_sdata4: result = (int32_t)get32(addr); p += 4; addr = (pint_t)p; break; case DW_EH_PE_sdata8: result = get64(addr); p += 8; addr = (pint_t)p; break; case DW_EH_PE_omit: result = 0; break; default: assert(0 && "unknown pointer encoding"); } // then add relative offset switch (encoding & 0x70) { case DW_EH_PE_absptr: // do nothing break; case DW_EH_PE_pcrel: result += startAddr; break; case DW_EH_PE_textrel: assert(0 && "DW_EH_PE_textrel pointer encoding not supported"); break; case DW_EH_PE_datarel: assert(ctx != NULL && "DW_EH_PE_datarel without context"); if (ctx) result += ctx->data_base; break; case DW_EH_PE_funcrel: assert(ctx != NULL && "DW_EH_PE_funcrel without context"); if (ctx) result += ctx->start_ip; break; case DW_EH_PE_aligned: __builtin_unreachable(); default: assert(0 && "unknown pointer encoding"); break; } if (encoding & DW_EH_PE_indirect) result = getP(result); return result; }
GLuint64 Query::waitAndGet64(const GLenum pname, const std::chrono::duration<int, std::nano> & timeout) const { wait(timeout); return get64(pname); }
GLuint64 Query::waitAndGet64(const GLenum pname) const { wait(); return get64(pname); }
LocalAddressSpace::pint_t LocalAddressSpace::getEncodedP(pint_t& addr, pint_t end, uint8_t encoding) { pint_t startAddr = addr; const uint8_t* p = (uint8_t*)addr; pint_t result; // first get value switch (encoding & 0x0F) { case DW_EH_PE_ptr: result = getP(addr); p += sizeof(pint_t); addr = (pint_t)p; break; case DW_EH_PE_uleb128: result = getULEB128(addr, end); break; case DW_EH_PE_udata2: result = get16(addr); p += 2; addr = (pint_t)p; break; case DW_EH_PE_udata4: result = get32(addr); p += 4; addr = (pint_t)p; break; case DW_EH_PE_udata8: result = get64(addr); p += 8; addr = (pint_t)p; break; case DW_EH_PE_sleb128: result = getSLEB128(addr, end); break; case DW_EH_PE_sdata2: result = (int16_t)get16(addr); p += 2; addr = (pint_t)p; break; case DW_EH_PE_sdata4: result = (int32_t)get32(addr); p += 4; addr = (pint_t)p; break; case DW_EH_PE_sdata8: result = get64(addr); p += 8; addr = (pint_t)p; break; default: ABORT("unknown pointer encoding"); } // then add relative offset switch ( encoding & 0x70 ) { case DW_EH_PE_absptr: // do nothing break; case DW_EH_PE_pcrel: result += startAddr; break; case DW_EH_PE_textrel: ABORT("DW_EH_PE_textrel pointer encoding not supported"); break; case DW_EH_PE_datarel: ABORT("DW_EH_PE_datarel pointer encoding not supported"); break; case DW_EH_PE_funcrel: ABORT("DW_EH_PE_funcrel pointer encoding not supported"); break; case DW_EH_PE_aligned: ABORT("DW_EH_PE_aligned pointer encoding not supported"); break; default: ABORT("unknown pointer encoding"); break; } if ( encoding & DW_EH_PE_indirect ) result = getP(result); return result; }