-#error unimplemented!
-#endif
-
-
-/* uint16_t i,j=0;
- uint16_t scale_w;
- bigint_word_t *dst;
- bigint_wordplus_t t=0;
- scale_w = (scale+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
- if(scale>dest->length_B*sizeof(bigint_word_t)){
- memset(((uint8_t*)dest->wordv)+dest->length_B*sizeof(bigint_word_t), 0, scale-dest->length_B*sizeof(bigint_word_t));
- }
- // a->wordv = (const uint32_t*)(((uint8_t*)a->wordv)+(scale&3));
- dst = dest->wordv + (scale&(sizeof(bigint_word_t)-1));
- for(i=scale/sizeof(bigint_word_t); i<a->length_B+scale_w; ++i,++j){
- t += a->wordv[j];
- if(dest->length_B>i){
- t += dst[i];
- }
- dst[i] = (bigint_word_t)t;
- t>>=BIGINT_WORD_SIZE;
- }
- while(t){
- if(dest->length_B>i){
- t += dst[i];
- }
- dst[i] = (bigint_word_t)t;
- t>>=BIGINT_WORD_SIZE;
- ++i;
- }
- if(dest->length_B < i){
- dest->length_B = i;
+ bigint_t s;
+ uint16_t word_shift = scale / sizeof(bigint_word_t), byte_shift = scale % sizeof(bigint_word_t);
+ bigint_word_t bv[a->length_W + 1];
+ s.wordv = bv;
+ bv[0] = bv[a->length_W] = 0;
+ memcpy((uint8_t*)bv + byte_shift, a->wordv, a->length_W * sizeof(bigint_word_t));
+ s.length_W = a->length_W + 1;
+ bigint_adjust(&s);
+ memset(dest->wordv + dest->length_W, 0, (MAX(dest->length_W, s.length_W + word_shift) - dest->length_W) * sizeof(bigint_word_t));
+ x.wordv = dest->wordv + word_shift;
+ x.length_W = dest->length_W - word_shift;
+ if((int16_t)x.length_W < 0){
+ x.length_W = 0;
+ x.info = 0;
+ }else{
+ x.info = dest->info;