HISKP-LQCD / sLapH-contractions

Stochastic LapH contraction program
GNU General Public License v3.0
3 stars 3 forks source link

Signed and unsigned integer arithmetic #26

Closed martin-ueding closed 6 years ago

martin-ueding commented 7 years ago

The question to use signed or unsigned integer arithmetic usually is whether one wants to store negative numbers. However, I now have the impression that the actual question rather is whether one needs well-defined overflow, i.e. modular arithmetics. And in our cases here we do not want that.

Therefore we should eventually change everything to a signed integer type, be it int, int8_t or int64_t or ssize_t.

martin-ueding commented 6 years ago

The code compiles without any warnings now!

Use the function ssize(vec) instead of vec.size() to get a ssize_t instead of size_t when working with std::vector.