+
+/* Compute a value for nloop. */
+
+static int
+compute_nloop (type, nregs, bytes)
+ gif_type type;
+ int nregs, bytes;
+{
+ int computed_nloop;
+
+ switch (type)
+ {
+ case GIF_PACKED :
+ /* We can't compute a value if no regs were specified and there is a
+ non-zero amount of data. Just set to something useful, a warning
+ will be issued later. */
+ if (nregs == 0)
+ nregs = 1;
+ computed_nloop = (bytes >> 4) / nregs;
+ break;
+ case GIF_REGLIST :
+ if (nregs == 0)
+ nregs = 1;
+ computed_nloop = (bytes >> 3) / nregs;
+ break;
+ case GIF_IMAGE :
+ computed_nloop = bytes >> 4;
+ break;
+ }
+
+ return computed_nloop;
+}
+
+/* Issue a warning if the user specified nloop value doesn't match the
+ computed value. */
+
+static void
+check_nloop (type, nregs, user_nloop, computed_nloop, file, line)
+ gif_type type;
+ int nregs,user_nloop,computed_nloop;
+ char *file;
+ unsigned int line;
+{
+ if (user_nloop != computed_nloop)
+ as_warn_where (file, line, "nloop value does not match amount of data");
+}