mawinkle hace 6 años
padre
commit
7c9b353543
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      BigInt.hpp

+ 7 - 2
BigInt.hpp

@@ -144,7 +144,7 @@ struct BigInt{
 	inline BigInt& chunkshiftLeft(int c){
 		if(c < 0)return chunkshiftRight(-c);
 		for(int i = 0;i < size() - c;i++){
-			data[i] = data[i] + c;
+			data[i] = data[i + c];
 		}
 		for(int i = size() - c;i < size();i++){
 			data[i] = 0;
@@ -154,7 +154,12 @@ struct BigInt{
 	
 	inline BigInt& chunkshiftRight(int c){
 		if(c < 0)return chunkshiftLeft(-c);
-		
+		for(int i = size() - 1;i >= c;i--){
+			data[i] = data[i - c];
+		}
+		for(int i = c - 1;i >= 0;i--){
+			data[i] = 0;
+		}
 	}
 	
 	inline size_t size()const{