
#ifndef PLS_STAMPED_SPLIT_INTEGER_H_
#define PLS_STAMPED_SPLIT_INTEGER_H_

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

namespace pls::internal::data_structures {

struct stamped_split_integer {
  using member_t = base::system_details::cas_integer;

  member_t stamp_: base::system_details::CAS_SIZE / 2;
  member_t value_1_: base::system_details::CAS_SIZE / 4;
  member_t value_2_: base::system_details::CAS_SIZE / 4;

  stamped_split_integer() : stamp_{0}, value_1_{0}, value_2_{0} {};
  stamped_split_integer(member_t value_1, member_t value_2) : stamp_{0}, value_1_{value_1}, value_2_{value_2} {};
  stamped_split_integer(member_t new_stamp, member_t value_1, member_t value_2) : stamp_{new_stamp},
                                                                                  value_1_{value_1},
                                                                                  value_2_{value_2} {};

  bool operator==(const stamped_split_integer &other) const noexcept {
    return stamp_ == other.stamp_ && value_1_ == other.value_1_ && value_2_ == other.value_2_;
  }

  bool operator!=(const stamped_split_integer &other) const noexcept {
    return !(*this == other);
  }
};

}

#endif //PLS_STAMPED_SPLIT_INTEGER_H_
