Electroneum
Loading...
Searching...
No Matches
difficulty_type.h File Reference
Include dependency graph for difficulty_type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  is_basic_type< cryptonote::difficulty_type >

Functions

template<template< bool > class Archive>
bool do_serialize (Archive< false > &ar, cryptonote::difficulty_type &diff)
template<template< bool > class Archive>
bool do_serialize (Archive< true > &ar, cryptonote::difficulty_type &diff)

Function Documentation

◆ do_serialize() [1/2]

template<template< bool > class Archive>
bool do_serialize ( Archive< false > & ar,
cryptonote::difficulty_type & diff )
inline

Definition at line 37 of file difficulty_type.h.

38{
39 uint64_t hi, lo;
40 ar.serialize_varint(hi);
41 if (!ar.stream().good())
42 return false;
43 ar.serialize_varint(lo);
44 if (!ar.stream().good())
45 return false;
46 diff = hi;
47 diff <<= 64;
48 diff += lo;
49 return true;
50}
unsigned __int64 uint64_t
Definition stdint.h:136

◆ do_serialize() [2/2]

template<template< bool > class Archive>
bool do_serialize ( Archive< true > & ar,
cryptonote::difficulty_type & diff )
inline

Definition at line 53 of file difficulty_type.h.

54{
55 if (!ar.stream().good())
56 return false;
57 const uint64_t hi = ((diff >> 64) & 0xffffffffffffffff).convert_to<uint64_t>();
58 const uint64_t lo = (diff & 0xffffffffffffffff).convert_to<uint64_t>();
59 ar.serialize_varint(hi);
60 ar.serialize_varint(lo);
61 if (!ar.stream().good())
62 return false;
63 return true;
64}