mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-17 16:44:00 +00:00
Add include for stdlib.h, reorder functions to avoid implicit function declaration error for imod64bit()
This commit is contained in:
parent
cd437f0fc5
commit
45a547e088
25
src/keylib.c
25
src/keylib.c
@ -23,6 +23,7 @@ static char *id = "$Id: keylib.c,v 1.4 2001/12/24 01:09:03 sybalsky Exp $ Copyri
|
||||
============================================================================== */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@ -40,18 +41,6 @@ unsigned long date_integer16(const char *date);
|
||||
unsigned long idate(const char *str);
|
||||
unsigned long modify(unsigned long hostid);
|
||||
|
||||
/* ===========================================================================
|
||||
MAKE_VERIFICATION forms a new 32-bit integer by messaging the two input
|
||||
long integers x and y. The number was created from the lower bits toward
|
||||
higher bits.
|
||||
=============================================================================*/
|
||||
|
||||
unsigned long make_verification(long unsigned int x, long unsigned int y) {
|
||||
return (imod64bit(x, y, 4) | (imod64bit(x, y, 6) << 3) | (imod64bit(x, y, 13) << 6) |
|
||||
(imod64bit(x, y, 25) << 10) | (imod64bit(x, y, 30) << 15) | (imod64bit(x, y, 63) << 20) |
|
||||
(imod64bit(x, y, 5) << 26) | (imod64bit(x, y, 7) << 29));
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
IMOD64BIT computs (IMOD X Y).
|
||||
X is a 64-bit integer; x1 is the higher 32-bit while x0 is the lower 32-bit.
|
||||
@ -64,6 +53,18 @@ int imod64bit(unsigned long x1, unsigned long x0, unsigned long y) {
|
||||
return (((x0 % y) + ((x1 % y) * ((y + 1) % y))) % y);
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
MAKE_VERIFICATION forms a new 32-bit integer by messaging the two input
|
||||
long integers x and y. The number was created from the lower bits toward
|
||||
higher bits.
|
||||
=============================================================================*/
|
||||
|
||||
unsigned long make_verification(long unsigned int x, long unsigned int y) {
|
||||
return (imod64bit(x, y, 4) | (imod64bit(x, y, 6) << 3) | (imod64bit(x, y, 13) << 6) |
|
||||
(imod64bit(x, y, 25) << 10) | (imod64bit(x, y, 30) << 15) | (imod64bit(x, y, 63) << 20) |
|
||||
(imod64bit(x, y, 5) << 26) | (imod64bit(x, y, 7) << 29));
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
DATE_INTEGER16 takes a date string and return an intger
|
||||
=============================================================*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user