
#ifndef PREDICTABLE_PARALLEL_PATTERNS_LIB_PLS_INCLUDE_PLS_INTERNAL_DATA_STRUCTURES_STAMPED_INTEGER_H_
#define PREDICTABLE_PARALLEL_PATTERNS_LIB_PLS_INCLUDE_PLS_INTERNAL_DATA_STRUCTURES_STAMPED_INTEGER_H_

#include "pls/internal/base/system_details.h"

namespace pls {
namespace internal {
namespace data_structures {

constexpr unsigned long HALF_CACHE_LINE = base::system_details::CACHE_LINE_SIZE / 2;
struct stamped_integer {
  using member_t = base::system_details::cas_integer;

  member_t stamp:HALF_CACHE_LINE;
  member_t value:HALF_CACHE_LINE;

  stamped_integer() : stamp{0}, value{0} {};
  stamped_integer(member_t new_value) : stamp{0}, value{new_value} {};
  stamped_integer(member_t new_stamp, member_t new_value) : stamp{new_stamp}, value{new_value} {};
};

}
}
}

#endif //PREDICTABLE_PARALLEL_PATTERNS_LIB_PLS_INCLUDE_PLS_INTERNAL_DATA_STRUCTURES_STAMPED_INTEGER_H_
