home *** CD-ROM | disk | FTP | other *** search
- #include "utils.h"
- #define ABS(X) (X<0?-X:X)
-
- LONG strtoint(const CHAR * q)
- {
- LONG res=0;
- LONG i=0;
- LONG j;
- while (q[i]!='\0')
- i++;
- if (i==0)
- return 0;
- j=1;
- LONG t;
- while (i>0)
- {
- i--;
- t=q[i]-'0';
- if ((t>=0)&&(t<=9)) {
- res+=j*t;
- j*=10;
- }
- }
- return res;
- }
-
- USHORT Check2Shift(ULONG number)
- {
- USHORT count=0;
- ULONG temp=number;
- while (temp>1) {
- count++;
- temp>>=1;
- }
- return count;
- }