|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflslot.h" int year_slot_clear (byte *range, int day_from, int day_to)
Clears the slots for the specified day range. If day_to is zero, it is ignored; only the slot for day_from is cleared. Returns 0 if okay, -1 if the specified range is invalid.
{
if (day_to == 0)
day_to = day_from; /* Range is just one day */
if (day_from > day_to)
return (-1); /* Bad range */
while (day_from <= day_to) /* Find and clear each bit */
{
ASSERT (day_from >= 0 && day_from < MAX_DAY);
range [BYTE (day_from)] &= 255 - BIT (day_from);
day_from++;
}
return (0); /* No errors */
}
| | << | < | > | >> |
|