From: Leandro Lucarella Date: Tue, 4 Oct 2005 01:38:53 +0000 (+0000) Subject: Casts a la C++ (static_cast). X-Git-Tag: Entrega_1~48 X-Git-Url: https://git.llucax.com/z.facultad/75.29/dale.git/commitdiff_plain/6b51b97d7cab99f7809deee2601ebba53f24e334?ds=inline Casts a la C++ (static_cast). --- diff --git a/src/number.h b/src/number.h index dfd7934..5b0b71e 100644 --- a/src/number.h +++ b/src/number.h @@ -70,7 +70,8 @@ struct number // Devuelve referencia a 'átomo' i del chunk (no debería ser necesario // si la multiplicación es un método de este objeto). - native_type& operator[] (size_type i) { + native_type& operator[] (size_type i) + { return chunk[i]; } @@ -89,6 +90,7 @@ struct number friend std::ostream& operator<< (std::ostream& os, const number< NN, EE>& n); // Atributos + //private: chunk_type chunk; sign_type sign; @@ -355,8 +357,8 @@ number < N, E > naif(const number< N, E > &u, const number< N, E > &v) * buffer. Si, es feo. */ E tmp; - tmp = (E) u.chunk[0] * (E) v.chunk[0]; - num_type tnum = num_type((N *) &tmp, 2, sign); + tmp = static_cast< E >(u.chunk[0]) * static_cast< E >(v.chunk[0]); + num_type tnum = num_type(static_cast< N* >(&tmp), 2, sign); //std::cout << "T:" << tnum << " " << tmp << "\n"; //printf("1: %lu %lu %llu\n", u.chunk[0], v.chunk[0], tmp); return tnum;