public static ValAndOff addOffset64(this ValAndOff x, long off) => func((_, panic, __) => { if (!x.canAdd(off)) { panic("invalid ValAndOff.add"); } return(ValAndOff(makeValAndOff(x.Val(), x.Off() + off))); });
public static bool canAdd(this ValAndOff x, long off) { var newoff = x.Off() + off; return(newoff == int64(int32(newoff))); }
public static bool canAdd32(this ValAndOff x, int off) { var newoff = x.Off() + int64(off); return(newoff == int64(int32(newoff))); }
public static @string String(this ValAndOff x) { return(fmt.Sprintf("val=%d,off=%d", x.Val(), x.Off())); }