Skip to content

Commit

Permalink
ADD WORD SIZE DETECTION FOR MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningEnlightenment authored and aklomp committed Jul 5, 2016
1 parent 3d16dd3 commit fcab175
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/codec_plain.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
BASE64_ENC_FUNCTION(plain)
{
#include "enc/head.c"
#if __WORDSIZE == 32
#if BASE64_WORDSIZE == 32
#include "enc/uint32.c"
#elif __WORDSIZE == 64
#elif BASE64_WORDSIZE == 64
#include "enc/uint64.c"
#endif
#include "enc/tail.c"
Expand All @@ -19,9 +19,9 @@ BASE64_ENC_FUNCTION(plain)
BASE64_DEC_FUNCTION(plain)
{
#include "dec/head.c"
#if __WORDSIZE == 32
#if BASE64_WORDSIZE == 32
#include "dec/uint32.c"
#elif __WORDSIZE == 64
#elif BASE64_WORDSIZE == 64
#include "dec/uint64.c"
#endif
#include "dec/tail.c"
Expand Down
7 changes: 7 additions & 0 deletions lib/codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ struct codec
#define cpu_to_be64(x) (x)
#define be32_to_cpu(x) (x)
#define be64_to_cpu(x) (x)
#endif

// detect word size
#ifdef _INTEGRAL_MAX_BITS
#define BASE64_WORDSIZE _INTEGRAL_MAX_BITS
#else
#define BASE64_WORDSIZE __WORDSIZE
#endif

void codec_choose (struct codec *, int flags);
Expand Down

0 comments on commit fcab175

Please sign in to comment.