blob: 65970cf641665db391e3c44754af7251cf7e9562 [file] [log] [blame]
/*
* Copyright 2010 INRIA Saclay
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
* Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
* 91893 Orsay, France
*/
#include <isl_pw_macro.h>
__isl_give PW *FN(PW,neg)(__isl_take PW *pw)
{
int i;
if (!pw)
return NULL;
if (FN(PW,IS_ZERO)(pw))
return pw;
pw = FN(PW,cow)(pw);
if (!pw)
return NULL;
for (i = 0; i < pw->n; ++i) {
pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
if (!pw->p[i].FIELD)
return FN(PW,free)(pw);
}
return pw;
}