mirror of
https://github.com/wownero/RandomWOW.git
synced 2026-11-17 05:24:02 +01:00
Sanity checks (#88)
This commit is contained in:
@@ -26,6 +26,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "reciprocal.h"
|
||||
|
||||
/*
|
||||
@@ -45,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
uint64_t randomx_reciprocal(uint64_t divisor) {
|
||||
|
||||
assert(divisor != 0);
|
||||
|
||||
const uint64_t p2exp63 = 1ULL << 63;
|
||||
|
||||
uint64_t quotient = p2exp63 / divisor, remainder = p2exp63 % divisor;
|
||||
|
||||
Reference in New Issue
Block a user