Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wolf3d
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
wolf3d
Commits
57078b58
Commit
57078b58
authored
Jan 30, 2005
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup.
parent
97f342f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
misc.c
src/misc.c
+15
-6
misc.h
src/misc.h
+1
-1
No files found.
src/misc.c
View file @
57078b58
...
@@ -9,32 +9,33 @@
...
@@ -9,32 +9,33 @@
#define O_BINARY 0
#define O_BINARY 0
#endif
#endif
/* TimeCount from David Haslam -- dch@sirius.demon.co.uk */
static
struct
timeval
t0
;
static
struct
timeval
t0
;
static
long
tc0
;
static
unsigned
long
tc0
;
void
set_TimeCount
(
unsigned
long
t
)
void
set_TimeCount
(
unsigned
long
t
)
{
{
tc0
=
t
;
tc0
=
t
;
gettimeofday
(
&
t0
,
NULL
);
gettimeofday
(
&
t0
,
NULL
);
}
}
unsigned
long
get_TimeCount
()
unsigned
long
get_TimeCount
(
void
)
{
{
struct
timeval
t1
;
struct
timeval
t1
;
long
secs
,
usecs
;
long
secs
,
usecs
;
long
tc
;
unsigned
long
tc
;
gettimeofday
(
&
t1
,
NULL
);
gettimeofday
(
&
t1
,
NULL
);
secs
=
t1
.
tv_sec
-
t0
.
tv_sec
;
secs
=
t1
.
tv_sec
-
t0
.
tv_sec
;
usecs
=
t1
.
tv_usec
-
t0
.
tv_usec
;
usecs
=
t1
.
tv_usec
-
t0
.
tv_usec
;
if
(
usecs
<
0
)
{
if
(
usecs
<
0
)
{
usecs
+=
1000000
;
usecs
+=
1000000
;
secs
--
;
secs
--
;
}
}
tc
=
tc0
+
secs
*
70
+
usecs
*
70
/
1000000
;
tc
=
tc0
+
secs
*
70
+
(
usecs
*
70
)
/
1000000
;
return
tc
;
return
tc
;
}
}
...
@@ -65,6 +66,8 @@ char *strlwr(char *s)
...
@@ -65,6 +66,8 @@ char *strlwr(char *s)
char
*
itoa
(
int
value
,
char
*
string
,
int
radix
)
char
*
itoa
(
int
value
,
char
*
string
,
int
radix
)
{
{
(
void
)
radix
;
/* wolf3d only uses radix 10 */
/* wolf3d only uses radix 10 */
sprintf
(
string
,
"%d"
,
value
);
sprintf
(
string
,
"%d"
,
value
);
return
string
;
return
string
;
...
@@ -72,12 +75,18 @@ char *itoa(int value, char *string, int radix)
...
@@ -72,12 +75,18 @@ char *itoa(int value, char *string, int radix)
char
*
ltoa
(
long
value
,
char
*
string
,
int
radix
)
char
*
ltoa
(
long
value
,
char
*
string
,
int
radix
)
{
{
(
void
)
radix
;
/* wolf3d only uses radix 10 */
sprintf
(
string
,
"%ld"
,
value
);
sprintf
(
string
,
"%ld"
,
value
);
return
string
;
return
string
;
}
}
char
*
ultoa
(
unsigned
long
value
,
char
*
string
,
int
radix
)
char
*
ultoa
(
unsigned
long
value
,
char
*
string
,
int
radix
)
{
{
(
void
)
radix
;
/* wolf3d only uses radix 10 */
sprintf
(
string
,
"%lu"
,
value
);
sprintf
(
string
,
"%lu"
,
value
);
return
string
;
return
string
;
}
}
...
...
src/misc.h
View file @
57078b58
...
@@ -8,7 +8,7 @@ void SavePCX256ToFile(const unsigned char *buf, int width, int height, const uns
...
@@ -8,7 +8,7 @@ void SavePCX256ToFile(const unsigned char *buf, int width, int height, const uns
void
SavePCXRGBToFile
(
const
unsigned
char
*
buf
,
int
width
,
int
height
,
const
char
*
name
);
void
SavePCXRGBToFile
(
const
unsigned
char
*
buf
,
int
width
,
int
height
,
const
char
*
name
);
void
set_TimeCount
(
unsigned
long
t
);
void
set_TimeCount
(
unsigned
long
t
);
unsigned
long
get_TimeCount
();
unsigned
long
get_TimeCount
(
void
);
long
filelength
(
int
handle
);
long
filelength
(
int
handle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment