| 1044 | // ------------------------------------------------ |
| 1045 | |
| 1046 | void Int::SetBaseN(int n,char *charset,char *value) { |
| 1047 | |
| 1048 | CLEAR(); |
| 1049 | |
| 1050 | Int pw((uint64_t)1); |
| 1051 | Int nb((uint64_t)n); |
| 1052 | Int c; |
| 1053 | |
| 1054 | int lgth = (int)strlen(value); |
| 1055 | for(int i=lgth-1;i>=0;i--) { |
| 1056 | char *p = strchr(charset,toupper(value[i])); |
| 1057 | if(!p) { |
| 1058 | printf("Invalid charset !!\n"); |
| 1059 | return; |
| 1060 | } |
| 1061 | int id = (int)(p-charset); |
| 1062 | c.SetInt32(id); |
| 1063 | c.Mult(&pw); |
| 1064 | Add(&c); |
| 1065 | pw.Mult(&nb); |
| 1066 | |
| 1067 | } |
| 1068 | |
| 1069 | } |
| 1070 | |
| 1071 | // ------------------------------------------------ |
| 1072 | |