Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
00fc6b9d
Commit
00fc6b9d
authored
11 years ago
by
Alam Ed Arias
Browse files
Options
Downloads
Plain Diff
Merge branch 'endianess' of github.com:AMDmi3/SRB2
parents
5b5fbe9a
7d52913a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/endian.h
+45
-0
45 additions, 0 deletions
src/endian.h
src/m_swap.h
+3
-1
3 additions, 1 deletion
src/m_swap.h
src/md5.c
+2
-7
2 additions, 7 deletions
src/md5.c
with
50 additions
and
8 deletions
src/endian.h
0 → 100644
+
45
−
0
View file @
00fc6b9d
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file endian.h
/// \brief Endian detection
#ifndef __ENDIAN__
#define __ENDIAN__
#if defined(SRB2_BIG_ENDIAN) || defined(SRB2_LITTLE_ENDIAN)
// defined externally
#else
#if defined(__FreeBSD__)
// on FreeBSD, _BIG_ENDIAN is a constant to compare
// _BYTE_ORDER to, not a big-endianess flag
#include
<sys/endian.h>
#if _BYTE_ORDER == _BIG_ENDIAN
#define SRB2_BIG_ENDIAN
#else
#define SRB2_LITTLE_ENDIAN
#endif
#elif defined(__BYTE_ORDER__)
// defined by at least gcc and clang
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define SRB2_BIG_ENDIAN
#else
#define SRB2_LITTLE_ENDIAN
#endif
#else
// check used in vanilla SRB2 (may work incorrectly if
// _BIG_ENDIAN is used as on FreeBSD)
#if defined(_BIG_ENDIAN)
#define SRB2_BIG_ENDIAN
#else
#define SRB2_LITTLE_ENDIAN
#endif
#endif
#endif
#endif //__ENDIAN__
This diff is collapsed.
Click to expand it.
src/m_swap.h
+
3
−
1
View file @
00fc6b9d
...
...
@@ -14,9 +14,11 @@
#ifndef __M_SWAP__
#define __M_SWAP__
#include
"endian.h"
// Endianess handling.
// WAD files are stored little endian.
#ifdef _BIG_ENDIAN
#ifdef
SRB2
_BIG_ENDIAN
#define SHORT(x) ((INT16)(\
(((UINT16)(x) & (UINT16)0x00ffU) << 8) \
...
...
This diff is collapsed.
Click to expand it.
src/md5.c
+
2
−
7
View file @
00fc6b9d
...
...
@@ -44,14 +44,9 @@
#include
"md5.h"
#ifdef _LIBC
#include
<endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define WORDS_BIGENDIAN 1
#endif
#endif
#include
"endian.h"
#if defined (
WORDS_BIGENDIAN) || defined (
_BIG_ENDIAN)
#if defined (
SRB2
_BIG_ENDIAN)
#define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment