/* Copyright (c) 2009 Ian Piumarta
 * All rights reserved.
 * See the file COPYING for details.
 */

#include "_mpint.h"

/* remove leading zeros from mp */

mp_t *mp_normalise(mp_t *mp)
{
  mp_ssize_t  w= mp->width;
  mp_digit_t *b= mp->bits;
  while (w-- && !b[w]);
  if (w < 0) return mp_clear(mp);
  mp->width= w + 1;
  return mp;
}

