Exemplo n.º 1
0
Integer64
DataElement::hash() const
{
  try {
    std::vector<Octet> buffer;
    encodeInto(buffer);
    Integer64 hash = 8191;
    for (std::vector<Octet>::const_iterator i = buffer.begin(); i != buffer.end(); ++i)
      hash = hash*Integer64(127) + Integer64(*i);
    return hash;
  } catch (const EncoderException&) {
    return -1;
  }
}
Exemplo n.º 2
0
__host__ __device__
typename enable_if<
  sizeof(Integer64) == 8,
  Integer64
>::type
atomic_load(const Integer64 *x)
{
#if defined(__CUDA_ARCH__)
  return atomicAdd(const_cast<Integer64*>(x), Integer64(0));
#elif defined(__GNUC__)
  return atomic_load_n(x, __ATOMIC_SEQ_CST);
#elif defined(_MSC_VER)
  return InterlockedExchangeAdd(x, Integer64(0));
#elif defined(__clang__)
  return __c11_atomic_load(x);
#else
#error "No atomic_load_n implementation."
#endif
}