package anoncard;
/**
 *
 * @author Petr Svenda
 */
public class Int_64 {
          public final static byte INT_64_LENGTH = 8;
          public short highest;
          public short higher;
          public short lower;
          public short lowest;

          public Int_64() {
          }
          public Int_64(short highest, short higher, short lower, short lowest) {
            set(highest, higher, lower, lowest);
          }
          public Int_64(Int_64 template) {
            set(template);
          }
          public void set(short highest, short higher, short lower, short lowest) {
            this.highest=highest;
            this.higher=higher;
            this.lower=lower;
            this.lowest=lowest;
          }
          public void set(Int_64 template) {
            this.highest=template.highest;
            this.higher=template.higher;
            this.lower=template.lower;
            this.lowest=template.lowest;
          }
          public void set(byte[] value, short offset) {
            this.highest = (short) (value[offset] << 8 | (short) ( value[(short) (offset + 1)] & 0xff));
            this.higher = (short) (value[(short) (offset + 2)] << 8 |(short) ( value[(short) (offset + 3)] & 0xff));
            this.lower = (short) (value[(short) (offset + 4)] << 8 | (short) ( value[(short) (offset + 5)] & 0xff));
            this.lowest = (short) (value[(short) (offset + 6)] << 8 | (short) ( value[(short) (offset + 7)] & 0xff));
          }

          public void set(short[] value, short offset) {
            this.highest = value[offset];
            this.higher = value[(short) (offset + 1)];
            this.lower = value[(short) (offset + 2)];
            this.lowest = value[(short) (offset + 3)];
          }

          public void get(byte[] value, short offset) {
            value[(short) (offset + 0)] = (byte) (highest >> 8);
            value[(short) (offset + 1)] = (byte) (highest & 0xff);
            value[(short) (offset + 2)] = (byte) (higher >> 8);
            value[(short) (offset + 3)] = (byte) (higher & 0xff);
            value[(short) (offset + 4)] = (byte) (lower >> 8);
            value[(short) (offset + 5)] = (byte) (lower & 0xff);
            value[(short) (offset + 6)] = (byte) (lowest >> 8);
            value[(short) (offset + 7)] = (byte) (lowest & 0xff);
          }
          public void get(short[] value, short offset) {
            value[(short) (offset + 0)] = highest;
            value[(short) (offset + 1)] = higher;
            value[(short) (offset + 2)] = lower;
            value[(short) (offset + 3)] = lowest;
          }
}
