Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/field_impl.h
/********************************************************************** | /********************************************************************** | ||||
* Copyright (c) 2013, 2014 Pieter Wuille * | * Copyright (c) 2013, 2014 Pieter Wuille * | ||||
* Distributed under the MIT software license, see the accompanying * | * Distributed under the MIT software license, see the accompanying * | ||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.* | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* | ||||
**********************************************************************/ | **********************************************************************/ | ||||
#ifndef SECP256K1_FIELD_IMPL_H | #ifndef SECP256K1_FIELD_IMPL_H | ||||
#define SECP256K1_FIELD_IMPL_H | #define SECP256K1_FIELD_IMPL_H | ||||
#if defined HAVE_CONFIG_H | #if defined HAVE_CONFIG_H | ||||
#include "libsecp256k1-config.h" | #include "libsecp256k1-config.h" | ||||
#endif | #endif | ||||
#include "util.h" | #include "util.h" | ||||
#include "num.h" | #include "num.h" | ||||
#if defined(USE_FIELD_10X26) | #if defined(SECP256K1_WIDEMUL_INT128) | ||||
#include "field_10x26_impl.h" | |||||
#elif defined(USE_FIELD_5X52) | |||||
#include "field_5x52_impl.h" | #include "field_5x52_impl.h" | ||||
#elif defined(SECP256K1_WIDEMUL_INT64) | |||||
#include "field_10x26_impl.h" | |||||
#else | #else | ||||
#error "Please select field implementation" | #error "Please select wide multiplication implementation" | ||||
#endif | #endif | ||||
SECP256K1_INLINE static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { | SECP256K1_INLINE static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { | ||||
secp256k1_fe na; | secp256k1_fe na; | ||||
secp256k1_fe_negate(&na, a, 1); | secp256k1_fe_negate(&na, a, 1); | ||||
secp256k1_fe_add(&na, b); | secp256k1_fe_add(&na, b); | ||||
return secp256k1_fe_normalizes_to_zero(&na); | return secp256k1_fe_normalizes_to_zero(&na); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |