Skip to content

Commit

Permalink
Const correctness in AVR backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Sep 9, 2013
1 parent ea8b57e commit f41c5a2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/low/avr-asm-271/relic_fb_mul_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "relic_fb_low.h"
#include "relic_util.h"

void fb_mul1_low(dig_t *c, dig_t *a, dig_t digit) {
void fb_mul1_low(dig_t *c, const dig_t *a, dig_t digit) {
dig_t carry;

fb_zero(c);
Expand All @@ -52,7 +52,7 @@ void fb_mul1_low(dig_t *c, dig_t *a, dig_t digit) {

#if FB_POLYN == 271

void fb_mulm_low(dig_t *c, dig_t *a, dig_t *b) {
void fb_mulm_low(dig_t *c, const dig_t *a, const dig_t *b) {
dv_t t;

dv_new(t);
Expand Down
32 changes: 17 additions & 15 deletions src/low/avr-asm-271/relic_fb_shift_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@
* @param bits
* @return
*/
dig_t fb_lshadd1_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd2_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd3_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd4_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd5_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd6_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd7_low(dig_t *c, dig_t *a, int size);
dig_t fb_lshadd1_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd2_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd3_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd4_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd5_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd6_low(dig_t *c, const dig_t *a, int size);
dig_t fb_lshadd7_low(dig_t *c, const dig_t *a, int size);
/*@} */


/*============================================================================*/
/* Public definitions */
/*============================================================================*/

dig_t fb_lshb_low(dig_t *c, dig_t *a, int bits) {
dig_t fb_lshb_low(dig_t *c, const dig_t *a, int bits) {
int i;
dig_t r, carry, shift;

Expand All @@ -81,8 +81,9 @@ dig_t fb_lshb_low(dig_t *c, dig_t *a, int bits) {
return carry;
}

void fb_lshd_low(dig_t *c, dig_t *a, int digits) {
dig_t *top, *bot;
void fb_lshd_low(dig_t *c, const dig_t *a, int digits) {
dig_t *top;
const dig_t *bot;
int i;

top = c + FB_DIGS + digits - 1;
Expand All @@ -96,7 +97,7 @@ void fb_lshd_low(dig_t *c, dig_t *a, int digits) {
}
}

dig_t fb_rshb_low(dig_t *c, dig_t *a, int bits) {
dig_t fb_rshb_low(dig_t *c, const dig_t *a, int bits) {
int i;
dig_t r, carry, mask, shift;

Expand All @@ -120,8 +121,9 @@ dig_t fb_rshb_low(dig_t *c, dig_t *a, int bits) {
return carry;
}

void fb_rshd_low(dig_t *c, dig_t *a, int digits) {
dig_t *top, *bot;
void fb_rshd_low(dig_t *c, const dig_t *a, int digits) {
const dig_t *top;
dig_t *bot;
int i;

top = a + digits;
Expand All @@ -137,7 +139,7 @@ void fb_rshd_low(dig_t *c, dig_t *a, int digits) {

#if FB_INV == EXGCD || !defined(STRIP)

dig_t fb_lshadd_low(dig_t *c, dig_t *a, int bits, int size) {
dig_t fb_lsha_low(dig_t *c, const dig_t *a, int bits, int size) {
if (bits == 1)
return fb_lshadd1_low(c, a, size);
if (bits == 2)
Expand All @@ -160,7 +162,7 @@ dig_t fb_lshadd_low(dig_t *c, dig_t *a, int bits, int size) {

#else

dig_t fb_lshadd_low(dig_t *c, dig_t *a, int bits, int size) {
dig_t fb_lsha_low(dig_t *c, const dig_t *a, int bits, int size) {
int i, j;
dig_t b1, b2;

Expand Down
2 changes: 1 addition & 1 deletion src/low/avr-asm-271/relic_fb_sqr_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/* Public definitions */
/*============================================================================*/

void fb_sqrm_low(dig_t *c, dig_t *a) {
void fb_sqrm_low(dig_t *c, const dig_t *a) {
dv_t t;

dv_new(t);
Expand Down
2 changes: 1 addition & 1 deletion src/low/avr-asm-271/relic_fb_srt_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void fb_srtp_low(dig_t *c, dig_t *t, dig_t *a);
/* Public definitions */
/*============================================================================*/

void fb_srtn_low(dig_t *c, dig_t *a) {
void fb_srtn_low(dig_t *c, const dig_t *a) {
dig_t t[FB_DIGS] = { 0 };

fb_srtp_low(c, t, a);
Expand Down

0 comments on commit f41c5a2

Please sign in to comment.