Massive refactoring, preparing for cn/2.

This commit is contained in:
XMRig 2018-10-04 15:52:12 +03:00
parent f0b293f650
commit 93d072ff6e
26 changed files with 1259 additions and 458 deletions

View file

@ -22,10 +22,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CRYPTONIGHT_SOFTAES_H__
#define __CRYPTONIGHT_SOFTAES_H__
#ifndef XMRIG_CRYPTONIGHT_SOFTAES_H
#define XMRIG_CRYPTONIGHT_SOFTAES_H
#include <x86intrin.h>
#include <stdint.h>
extern __m128i soft_aesenc(__m128i in, __m128i key);
extern __m128i soft_aeskeygenassist(__m128i key, uint8_t rcon);
@ -234,4 +237,20 @@ inline uint64_t _umul128(uint64_t multiplier, uint64_t multiplicand, uint64_t *p
#endif
#endif /* __CRYPTONIGHT_SOFTAES_H__ */
static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp)
{
mem_out[0] = EXTRACT64(tmp);
tmp = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(tmp), _mm_castsi128_ps(tmp)));
uint64_t vh = EXTRACT64(tmp);
uint8_t x = vh >> 24;
static const uint16_t table = 0x7531;
const uint8_t index = (((x >> 3) & 6) | (x & 1)) << 1;
vh ^= ((table >> index) & 0x3) << 28;
mem_out[1] = vh;
}
#endif /* XMRIG_CRYPTONIGHT_SOFTAES_H */