Minor cleanup.
This commit is contained in:
parent
542cb9a746
commit
df14bb6ae5
|
@ -28,8 +28,8 @@
|
||||||
#ifndef RANDOM_WELL512A_H
|
#ifndef RANDOM_WELL512A_H
|
||||||
#define RANDOM_WELL512A_H
|
#define RANDOM_WELL512A_H
|
||||||
|
|
||||||
#include <stdlib.h> // Needed for rand().
|
#include <stdlib.h> // Needed for rand().
|
||||||
#include <memory.h> // Needed for memcpy().
|
#include <memory.h> // Needed for memcpy().
|
||||||
|
|
||||||
class RandomWELL512a
|
class RandomWELL512a
|
||||||
{
|
{
|
||||||
|
@ -63,9 +63,9 @@ inline RandomWELL512a::RandomWELL512a(unsigned *seed)
|
||||||
|
|
||||||
inline unsigned RandomWELL512a::GetUnsigned()
|
inline unsigned RandomWELL512a::GetUnsigned()
|
||||||
{
|
{
|
||||||
#define MUTATE_LEFT(value, shift) value ^ (value << shift)
|
#define MUTATE_LEFT(value, shift) value ^ (value << shift)
|
||||||
#define MUTATE_RIGHT(value, shift) value ^ (value >> shift)
|
#define MUTATE_RIGHT(value, shift) value ^ (value >> shift)
|
||||||
#define MUTATE_LEFT_MIX(value, shift, mix) value ^ ((value << shift) & mix)
|
#define MUTATE_LEFT_MIX(value, shift, mix) value ^ ((value << shift) & mix)
|
||||||
|
|
||||||
unsigned index_9 = (index + 9) & 15;
|
unsigned index_9 = (index + 9) & 15;
|
||||||
unsigned index_13 = (index + 13) & 15;
|
unsigned index_13 = (index + 13) & 15;
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#ifndef RANDOM_WELL512A_SSE2_H
|
#ifndef RANDOM_WELL512A_SSE2_H
|
||||||
#define RANDOM_WELL512A_SSE2_H
|
#define RANDOM_WELL512A_SSE2_H
|
||||||
|
|
||||||
#include <emmintrin.h> // SSE2 instrinsics.
|
#include <emmintrin.h> // SSE2 instrinsics.
|
||||||
#include <stdlib.h> // Needed for rand().
|
#include <stdlib.h> // Needed for rand().
|
||||||
|
|
||||||
class RandomWELL512a_SSE2
|
class RandomWELL512a_SSE2
|
||||||
{
|
{
|
||||||
|
@ -86,12 +86,12 @@ inline double RandomWELL512a_SSE2::GetDouble()
|
||||||
|
|
||||||
inline void RandomWELL512a_SSE2::GetUnsigned4(unsigned *result4)
|
inline void RandomWELL512a_SSE2::GetUnsigned4(unsigned *result4)
|
||||||
{
|
{
|
||||||
unsigned index_15 = (index + 15) & 15;
|
unsigned index_15 = (index + 15) & 15;
|
||||||
__m128i state_index = state[index];
|
__m128i state_index = state[index];
|
||||||
__m128i state_index_9 = state[(index + 9) & 15];
|
__m128i state_index_9 = state[(index + 9) & 15];
|
||||||
__m128i state_index_13 = state[(index + 13) & 15];
|
__m128i state_index_13 = state[(index + 13) & 15];
|
||||||
__m128i state_index_15 = state[index_15];
|
__m128i state_index_15 = state[index_15];
|
||||||
const __m128i kMix = _mm_set1_epi32(0xda442d24);
|
const __m128i kMix = _mm_set1_epi32(0xda442d24);
|
||||||
|
|
||||||
__m128i left = _mm_xor_si128(state_index, _mm_slli_epi32(state_index, 16));
|
__m128i left = _mm_xor_si128(state_index, _mm_slli_epi32(state_index, 16));
|
||||||
__m128i right = _mm_xor_si128(state_index_13, _mm_slli_epi32(state_index_13, 15));
|
__m128i right = _mm_xor_si128(state_index_13, _mm_slli_epi32(state_index_13, 15));
|
||||||
|
|
|
@ -92,8 +92,8 @@ cleanall:
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "BUILD = Build mode. One of:"
|
@echo "BUILD = Build mode. One of:"
|
||||||
@echo " debug (default)"
|
@echo " debug (no optimizations)"
|
||||||
@echo " release (optimizations)"
|
@echo " release (optimizations, the default)"
|
||||||
@echo "APPS = Applications to build. Defaults to all."
|
@echo "APPS = Applications to build. Defaults to all."
|
||||||
@echo "VERBOSE = Full output from commands if set."
|
@echo "VERBOSE = Full output from commands if set."
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ $(EXES):
|
||||||
$(BUILD_DIR)/%.a:
|
$(BUILD_DIR)/%.a:
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(HUSH_GENERATE) $(AR) $(ARFLAGS) $@ $^
|
$(HUSH_GENERATE) $(AR) $(ARFLAGS) $@ $^
|
||||||
# $(HUSH_GENERATE) $(AR) $(ARFLAGS) $@ $^ 2> /dev/null
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(SRC_ROOT)/%.c
|
$(BUILD_DIR)/%.o: $(SRC_ROOT)/%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
|
|
@ -29,7 +29,7 @@ Original C 0.223 0.19
|
||||||
|
|
||||||
|
|
||||||
=== REQUIREMENTS ===
|
=== REQUIREMENTS ===
|
||||||
An SSE2 capable CPU (i.e. AMD Athlon 64, Intel Pentium 4 or newer.
|
An SSE2 capable CPU (i.e. AMD Athlon 64, Intel Pentium 4 or newer).
|
||||||
|
|
||||||
It's been tested with Visual Studio 2012 and gcc 4.6.3 but should compile
|
It's been tested with Visual Studio 2012 and gcc 4.6.3 but should compile
|
||||||
and run on other compilers as well.
|
and run on other compilers as well.
|
||||||
|
|
Loading…
Reference in New Issue