Use mask instead of modulo, since bo->backoff is always power of 2
[dfdiff.git] / sys / boot / ficl / sparc64 / sysdep.c
bloba9ab6cd3fb6190db5744a84d72c83dae17ba542e
1 /*******************************************************************
2 ** s y s d e p . c
3 ** Forth Inspired Command Language
4 ** Author: John Sadler (john_sadler@alum.mit.edu)
5 ** Created: 16 Oct 1997
6 ** Implementations of FICL external interface functions...
7 **
8 *******************************************************************/
11 * $FreeBSD: src/sys/boot/ficl/sparc64/sysdep.c,v 1.1 2002/05/19 23:20:56 jake Exp $
12 * $DragonFly: src/sys/boot/ficl/sparc64/sysdep.c,v 1.1 2003/11/10 06:08:34 dillon Exp $
15 #ifdef TESTMAIN
16 #include <stdio.h>
17 #include <stdlib.h>
18 #else
19 #include <stand.h>
20 #endif
21 #include "ficl.h"
24 ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith
27 #if PORTABLE_LONGMULDIV == 0
28 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
30 DPUNS q;
31 u_int64_t qx;
33 qx = (u_int64_t)x * (u_int64_t) y;
35 q.hi = (u_int32_t)( qx >> 32 );
36 q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
38 return q;
41 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
43 UNSQR result;
44 u_int64_t qx, qh;
46 qh = q.hi;
47 qx = (qh << 32) | q.lo;
49 result.quot = qx / y;
50 result.rem = qx % y;
52 return result;
54 #endif
56 void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
58 IGNORE(pVM);
60 while(*msg != 0)
61 putchar(*(msg++));
62 if (fNewline)
63 putchar('\n');
65 return;
68 void *ficlMalloc (size_t size)
70 return malloc(size);
73 void *ficlRealloc (void *p, size_t size)
75 return realloc(p, size);
78 void ficlFree (void *p)
80 free(p);
85 ** Stub function for dictionary access control - does nothing
86 ** by default, user can redefine to guarantee exclusive dict
87 ** access to a single thread for updates. All dict update code
88 ** is guaranteed to be bracketed as follows:
89 ** ficlLockDictionary(TRUE);
90 ** <code that updates dictionary>
91 ** ficlLockDictionary(FALSE);
93 ** Returns zero if successful, nonzero if unable to acquire lock
94 ** befor timeout (optional - could also block forever)
96 #if FICL_MULTITHREAD
97 int ficlLockDictionary(short fLock)
99 IGNORE(fLock);
100 return 0;
102 #endif /* FICL_MULTITHREAD */