mirror of
https://github.com/janet-lang/janet
synced 2024-12-25 07:50:27 +00:00
More explicit casts to please Microsoft compiler.
This commit is contained in:
parent
0fdd404a71
commit
7b28032f5c
@ -293,7 +293,7 @@ static Janet janet_io_fseek(int32_t argc, Janet *argv) {
|
||||
janet_panicf("expected one of :cur, :set, :end, got %v", argv[1]);
|
||||
}
|
||||
if (argc == 3) {
|
||||
offset = janet_getinteger64(argv, 2);
|
||||
offset = (long) janet_getinteger64(argv, 2);
|
||||
}
|
||||
}
|
||||
if (fseek(iof->file, offset, whence)) janet_panic("error seeking file");
|
||||
|
@ -183,7 +183,7 @@ static void string_description_b(JanetBuffer *buffer, const char *title, void *p
|
||||
*c++ = HEX(byte & 0xF);
|
||||
}
|
||||
*c++ = '>';
|
||||
buffer->count = c - buffer->data;
|
||||
buffer->count = (int32_t)(c - buffer->data);
|
||||
#undef POINTSIZE
|
||||
}
|
||||
|
||||
@ -966,7 +966,7 @@ static Janet cfun_join(int32_t argc, Janet *argv) {
|
||||
janet_panic("result string too long");
|
||||
}
|
||||
uint8_t *buf, *out;
|
||||
out = buf = janet_string_begin(finallen);
|
||||
out = buf = janet_string_begin((int32_t) finallen);
|
||||
for (i = 0; i < parts.len; i++) {
|
||||
const uint8_t *chunk = NULL;
|
||||
int32_t chunklen = 0;
|
||||
|
@ -116,7 +116,7 @@ static void bignat_muladd(struct BigNat *mant, uint32_t factor, uint32_t term) {
|
||||
mant->digits[i] = carry % BIGNAT_BASE;
|
||||
carry /= BIGNAT_BASE;
|
||||
}
|
||||
if (carry) bignat_append(mant, carry);
|
||||
if (carry) bignat_append(mant, (uint32_t) carry);
|
||||
}
|
||||
|
||||
/* Divide the mantissa mant by a factor. Drop the remainder. */
|
||||
@ -128,13 +128,13 @@ static void bignat_div(struct BigNat *mant, uint32_t divisor) {
|
||||
for (i = mant->n - 1; i >= 0; i--) {
|
||||
dividend = ((uint64_t)remainder * BIGNAT_BASE) + mant->digits[i];
|
||||
if (i < mant->n - 1) mant->digits[i + 1] = quotient;
|
||||
quotient = dividend / divisor;
|
||||
remainder = dividend % divisor;
|
||||
quotient = (uint32_t)(dividend / divisor);
|
||||
remainder = (uint32_t)(dividend % divisor);
|
||||
mant->digits[i] = remainder;
|
||||
}
|
||||
dividend = ((uint64_t)remainder * BIGNAT_BASE) + mant->first_digit;
|
||||
if (mant->n && mant->digits[mant->n - 1] == 0) mant->n--;
|
||||
mant->first_digit = dividend / divisor;
|
||||
mant->first_digit = (uint32_t)(dividend / divisor);
|
||||
}
|
||||
|
||||
/* Shift left by a multiple of BIGNAT_NBIT */
|
||||
@ -173,7 +173,7 @@ static double bignat_extract(struct BigNat *mant, int32_t exponent2) {
|
||||
uint64_t d1 = mant->digits[n - 1]; /* MSD (non-zero) */
|
||||
uint64_t d2 = (n == 1) ? mant->first_digit : mant->digits[n - 2];
|
||||
uint64_t d3 = (n > 2) ? mant->digits[n - 3] : (n == 2) ? mant->first_digit : 0;
|
||||
int lz = clz(d1);
|
||||
int lz = clz((uint32_t) d1);
|
||||
int nbits = 32 - lz;
|
||||
/* First get 54 bits */
|
||||
top53 = (d2 << (54 - BIGNAT_NBIT)) + (d3 >> (2 * BIGNAT_NBIT - 54));
|
||||
@ -192,7 +192,7 @@ static double bignat_extract(struct BigNat *mant, int32_t exponent2) {
|
||||
/* One digit */
|
||||
top53 = mant->first_digit;
|
||||
}
|
||||
return ldexp(top53, exponent2);
|
||||
return ldexp((double)top53, exponent2);
|
||||
}
|
||||
|
||||
/* Read in a mantissa and exponent of a certain base, and give
|
||||
|
Loading…
Reference in New Issue
Block a user