]> Git Repo - cpuminer-multi.git/commitdiff
vc2013: more fixes playing with defines
authorTanguy Pruvot <[email protected]>
Fri, 31 Oct 2014 08:43:26 +0000 (09:43 +0100)
committerTanguy Pruvot <[email protected]>
Fri, 31 Oct 2014 08:43:26 +0000 (09:43 +0100)
miner.h
neoscrypt.c
neoscrypt_asm.S
scrypt.c
sha2.c
util.c

diff --git a/miner.h b/miner.h
index 59782b82b9d48e6d2bc081c9538e411d4ac211c5..2ba3745065e1cd9da07f6bdd9af77ffbf5926600 100644 (file)
--- a/miner.h
+++ b/miner.h
@@ -3,6 +3,22 @@
 
 #include "cpuminer-config.h"
 
+#ifdef _MSC_VER
+
+#ifdef _MSC_VER
+#undef USE_ASM  /* to fix */
+#endif
+
+/* missing arch defines for msvc */
+#if defined(_M_X64)
+#define __i386__ 1
+#define __x86_64__ 1
+#elif defined(_M_X86)
+#define __i386__ 1
+#endif
+
+#endif
+
 #include <stdbool.h>
 #include <inttypes.h>
 #include <sys/time.h>
@@ -173,7 +189,7 @@ extern int scanhash_sha256d(int thr_id, uint32_t *pdata, const uint32_t *ptarget
 extern unsigned char *scrypt_buffer_alloc(int N);
 extern int scanhash_scrypt(int thr_id, uint32_t *pdata,
                             unsigned char *scratchbuf, const uint32_t *ptarget,
-                            uint32_t max_nonce, uint64_t *hashes_done, int N);
+                                                       uint32_t max_nonce, uint64_t *hashes_done, uint32_t N);
 
 extern int scanhash_keccak(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
                             uint32_t max_nonce, uint64_t *hashes_done);
index cfca1362ffe4d378cb611196b155d4f0024ca77d..a48345f7325338ce645d8d7aeef3dc4499e3496e 100644 (file)
@@ -38,8 +38,8 @@
 
 #define STACK_ALIGN 0x40
 
-#if defined(__i386__) || defined(_M_IA64) /*|| defined(_M_IX86) // tofix: win32 msvc */
-#define ASM 1
+#ifdef _MSC_VER // tofix: win32 msvc */
+#define ASM 0
 #endif
 
 #if (WINDOWS)
@@ -318,7 +318,7 @@ static void neoscrypt_pbkdf2_sha256(const uint8_t *password, size_t password_len
 
 /* NeoScrypt */
 
-#if defined(ASM)
+#if (ASM)
 
 extern void neoscrypt_salsa(uint *X, uint rounds);
 extern void neoscrypt_salsa_tangle(uint *X, uint count);
index 2f90dd69ee7f6848d061c44ffd3720c15c80e93a..014e2dddc585bb08c4824fe856f2deacb9d0e14c 100644 (file)
  * SUCH DAMAGE.
  */
 
-#if defined(_MSC_VER) && defined(_M_IX86)
-/* broken */
-//#define __i386__ 1
+#ifdef _MSC_VER
+/* arch defines */
+#include "miner.h"
 #endif
 
-#define ASM 1
-
 #if (ASM) && (__x86_64__)
 
 /* neoscrypt_blkcpy(dst, src, len) = SSE2 based block memcpy();
index 489ff320d2ac583645ef87b12545a56fc1adf0eb..4d6a9ca498d8ea58b7a2a5d5ef22f30a83d6beb0 100644 (file)
--- a/scrypt.c
+++ b/scrypt.c
@@ -258,7 +258,7 @@ static inline void PBKDF2_SHA256_128_32_4way(uint32_t *tstate,
 
 #ifdef HAVE_SHA256_8WAY
 
-static const uint32_t finalblk_8way[8 * 16] __attribute__((aligned(32))) = {
+static const uint32_t _ALIGN(32) finalblk_8way[8 * 16] = {
        0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
        0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000,
        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -280,8 +280,8 @@ static const uint32_t finalblk_8way[8 * 16] __attribute__((aligned(32))) = {
 static inline void HMAC_SHA256_80_init_8way(const uint32_t *key,
        uint32_t *tstate, uint32_t *ostate)
 {
-       uint32_t ihash[8 * 8] __attribute__((aligned(32)));
-       uint32_t pad[8 * 16] __attribute__((aligned(32)));
+       uint32_t _ALIGN(32) ihash[8 * 8];
+       uint32_t _ALIGN(32)  pad[8 * 16];
        int i;
        
        /* tstate is assumed to contain the midstate of key */
@@ -312,10 +312,10 @@ static inline void HMAC_SHA256_80_init_8way(const uint32_t *key,
 static inline void PBKDF2_SHA256_80_128_8way(const uint32_t *tstate,
        const uint32_t *ostate, const uint32_t *salt, uint32_t *output)
 {
-       uint32_t istate[8 * 8] __attribute__((aligned(32)));
-       uint32_t ostate2[8 * 8] __attribute__((aligned(32)));
-       uint32_t ibuf[8 * 16] __attribute__((aligned(32)));
-       uint32_t obuf[8 * 16] __attribute__((aligned(32)));
+       uint32_t _ALIGN(32) istate[8 * 8];
+       uint32_t _ALIGN(32) ostate2[8 * 8];
+       uint32_t _ALIGN(32) ibuf[8 * 16];
+       uint32_t _ALIGN(32) obuf[8 * 16];
        int i, j;
        
        memcpy(istate, tstate, 8 * 32);
@@ -356,7 +356,7 @@ static inline void PBKDF2_SHA256_80_128_8way(const uint32_t *tstate,
 static inline void PBKDF2_SHA256_128_32_8way(uint32_t *tstate,
        uint32_t *ostate, const uint32_t *salt, uint32_t *output)
 {
-       uint32_t buf[8 * 16] __attribute__((aligned(32)));
+       uint32_t _ALIGN(32) buf[8 * 16];
        int i;
        
        sha256_transform_8way(tstate, salt, 1);
@@ -570,8 +570,8 @@ static void scrypt_1024_1_1_256_4way(const uint32_t *input,
 static void scrypt_1024_1_1_256_3way(const uint32_t *input,
        uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
 {
-       uint32_t tstate[3 * 8], ostate[3 * 8];
-       uint32_t X[3 * 32] __attribute__((aligned(64)));
+       uint32_t _ALIGN(64) tstate[3 * 8], ostate[3 * 8];
+       uint32_t _ALIGN(64) X[3 * 32];
        uint32_t *V;
        
        V = (uint32_t *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
@@ -597,10 +597,10 @@ static void scrypt_1024_1_1_256_3way(const uint32_t *input,
 static void scrypt_1024_1_1_256_12way(const uint32_t *input,
        uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
 {
-       uint32_t tstate[12 * 8] __attribute__((aligned(128)));
-       uint32_t ostate[12 * 8] __attribute__((aligned(128)));
-       uint32_t W[12 * 32] __attribute__((aligned(128)));
-       uint32_t X[12 * 32] __attribute__((aligned(128)));
+       uint32_t _ALIGN(128) tstate[12 * 8];
+       uint32_t _ALIGN(128) ostate[12 * 8];
+       uint32_t _ALIGN(128) W[12 * 32];
+       uint32_t _ALIGN(128) X[12 * 32];
        uint32_t *V;
        int i, j, k;
        
@@ -648,10 +648,10 @@ static void scrypt_1024_1_1_256_12way(const uint32_t *input,
 static void scrypt_1024_1_1_256_24way(const uint32_t *input,
        uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
 {
-       uint32_t tstate[24 * 8] __attribute__((aligned(128)));
-       uint32_t ostate[24 * 8] __attribute__((aligned(128)));
-       uint32_t W[24 * 32] __attribute__((aligned(128)));
-       uint32_t X[24 * 32] __attribute__((aligned(128)));
+       uint32_t _ALIGN(128) tstate[24 * 8];
+       uint32_t _ALIGN(128) ostate[24 * 8];
+       uint32_t _ALIGN(128) W[24 * 32];
+       uint32_t _ALIGN(128) X[24 * 32];
        uint32_t *V;
        int i, j, k;
        
@@ -695,7 +695,7 @@ static void scrypt_1024_1_1_256_24way(const uint32_t *input,
 
 extern int scanhash_scrypt(int thr_id, uint32_t *pdata,
        unsigned char *scratchbuf, const uint32_t *ptarget,
-       uint32_t max_nonce, uint64_t *hashes_done, int N)
+       uint32_t max_nonce, uint64_t *hashes_done, uint32_t N)
 {
        uint32_t data[SCRYPT_MAX_WAYS * 20], hash[SCRYPT_MAX_WAYS * 8];
        uint32_t midstate[8];
diff --git a/sha2.c b/sha2.c
index 77608364e098e39da939b0514ce38705959ddae7..345cb6a37e943c1e477a71dddfb9f48d054cdb34 100644 (file)
--- a/sha2.c
+++ b/sha2.c
@@ -530,10 +530,10 @@ void sha256d_ms_8way(uint32_t *hash,  uint32_t *data,
 static inline int scanhash_sha256d_8way(int thr_id, uint32_t *pdata,
        const uint32_t *ptarget, uint32_t max_nonce, uint64_t *hashes_done)
 {
-       uint32_t data[8 * 64] __attribute__((aligned(128)));
-       uint32_t hash[8 * 8] __attribute__((aligned(32)));
-       uint32_t midstate[8 * 8] __attribute__((aligned(32)));
-       uint32_t prehash[8 * 8] __attribute__((aligned(32)));
+       uint32_t _ALIGN(128) data[8 * 64];
+       uint32_t _ALIGN(32)  hash[8 * 8];
+       uint32_t _ALIGN(32)  midstate[8 * 8];
+       uint32_t _ALIGN(32)  prehash[8 * 8];
        uint32_t n = pdata[19] - 1;
        const uint32_t first_nonce = pdata[19];
        const uint32_t Htarg = ptarget[7];
diff --git a/util.c b/util.c
index ef4801e63f927284df9bef91320829992ddce24c..1a2f61fac992cf16ef08a60cf48d9ccae62bdc04 100644 (file)
--- a/util.c
+++ b/util.c
@@ -109,7 +109,7 @@ void applog(int prio, const char *fmt, ...)
 
                pthread_mutex_lock(&applog_lock);
                tm_p = localtime(&now);
-               memcpy(&tm, tm_p, sizeof(tm));
+               memcpy(&tm, tm_p, sizeof(struct tm));
                pthread_mutex_unlock(&applog_lock);
 
                switch (prio) {
This page took 0.052119 seconds and 4 git commands to generate.