From 19769feaafe4f70d10611db0e0236edd6f1f0cd1 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 15 Jan 2020 18:13:06 +0100 Subject: [PATCH] fieldpattern:: error detection in EASY --- fieldpattern.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fieldpattern.cpp b/fieldpattern.cpp index 4a6897ff..783335cb 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -64,6 +64,9 @@ EX int btspin(int id, int d) { } #if HDR + +static const int ERR = -99; + struct fpattern { unsigned force_hash; @@ -94,6 +97,7 @@ struct fpattern { int add(int a, int b) { #ifdef EASY + if(a == ERR || b == ERR || a*b<0) return ERR; return (a+b)%Prime; #else return m(a%Prime+b%Prime) + Prime * m(a/Prime+b/Prime);