Skip to content

Instantly share code, notes, and snippets.

@pmhsfelix
Created May 19, 2011 12:50
Show Gist options
  • Save pmhsfelix/980675 to your computer and use it in GitHub Desktop.
Save pmhsfelix/980675 to your computer and use it in GitHub Desktop.
Using DbC preconditions: useful both as documentation and as integration checks
void epz_addMod(epz_ptr res, cepz_ptr op1, cepz_ptr op2, cepz_ptr mod){
ZREQUIRE1(STANDARD_RESIDUE(op1, mod) && STANDARD_RESIDUE(op2, mod));
ZREQUIRE0(POSITIVE(mod));
ZREQUIRE0(res != mod);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment