@@ -323,7 +323,13 @@ bool ffc_int_kind_is_signed(ffc_int_kind ik) {
323323ffc_internal ffc_inline
324324ffc_value_bits ffc_get_value_bits (ffc_value value, ffc_value_kind vk) {
325325 if (vk == FFC_VALUE_KIND_DOUBLE) {
326+ #if _MSC_VER && !defined(__clang__)
327+ ffc_value_bits bits;
328+ bits.di = ffc_get_double_bits (value.d );
329+ return bits;
330+ #else
326331 return (ffc_value_bits){.di =ffc_get_double_bits (value.d )};
332+ #endif
327333 } else {
328334 return (ffc_value_bits){.fi =ffc_get_float_bits (value.f )};
329335 }
@@ -1416,7 +1422,14 @@ ffc_result ffc_parse_int_string(
14161422 }
14171423
14181424 if (p == pend || base < 2 || base > 36 ) {
1425+ #if _MSC_VER && !defined(__clang__)
1426+ ffc_result invalid_input_result;
1427+ invalid_input_result.ptr = (char *)p;
1428+ invalid_input_result.outcome = FFC_OUTCOME_INVALID_INPUT;
1429+ return invalid_input_result;
1430+ #else
14191431 return (ffc_result){ .ptr = (char *)p, .outcome = FFC_OUTCOME_INVALID_INPUT };
1432+ #endif
14201433 }
14211434
14221435 ffc_result answer;
@@ -1461,7 +1474,11 @@ ffc_result ffc_parse_int_string(
14611474
14621475 if (digit_count == 0 ) {
14631476 if (has_leading_zeros) {
1477+ #if _MSC_VER && !defined(__clang__)
1478+ value->u64 = 0 ;
1479+ #else
14641480 *value = (ffc_int_value){0 }; // Largest variants are defined first so this will clear the entire union
1481+ #endif
14651482 answer.outcome = FFC_OUTCOME_OK;
14661483 answer.ptr = p;
14671484 } else {
@@ -1870,12 +1887,24 @@ bool ffc_sv_large_add_from_zero(ffc_sv* x, ffc_bigint_limb_span y) {
18701887// grade-school multiplication algorithm
18711888ffc_internal
18721889bool ffc_bigint_long_mul (ffc_sv* x, ffc_bigint_limb_span y) {
1890+ #if defined(_MSC_VER) && !defined(__clang__)
1891+ ffc_bigint_limb_span xs;
1892+ xs.ptr = x->data ;
1893+ xs.len = x->len ;
1894+ #else
18731895 ffc_bigint_limb_span xs = (ffc_bigint_limb_span){ .ptr = x->data , .len = x->len };
1896+ #endif
18741897
18751898 // full copy of x into z
18761899 ffc_sv z = ffc_sv_create (xs);
18771900
1901+ #if defined(_MSC_VER) && !defined(__clang__)
1902+ ffc_bigint_limb_span zs;
1903+ zs.ptr = z.data ;
1904+ zs.len = z.len ;
1905+ #else
18781906 ffc_bigint_limb_span zs = (ffc_bigint_limb_span){ .ptr = z.data , .len = z.len };
1907+ #endif
18791908
18801909 if (y.len != 0 ) {
18811910 ffc_bigint_limb y0 = ffc_span_index (y, 0 );
@@ -1889,7 +1918,13 @@ bool ffc_bigint_long_mul(ffc_sv* x, ffc_bigint_limb_span y) {
18891918 zi.len = 0 ;
18901919 FFC_TRY (ffc_sv_try_extend (&zi, zs));
18911920 FFC_TRY (ffc_bigint_small_mul (&zi, yi));
1921+ #if defined(_MSC_VER) && !defined(__clang__)
1922+ ffc_bigint_limb_span zis;
1923+ zis.ptr = zi.data ;
1924+ zis.len = zi.len ;
1925+ #else
18921926 ffc_bigint_limb_span zis = (ffc_bigint_limb_span){zi.data , zi.len };
1927+ #endif
18931928 FFC_TRY (ffc_bigint_large_add_from (x, zis, index));
18941929 }
18951930 }
@@ -1964,7 +1999,13 @@ ffc_inline ffc_internal
19641999ffc_bigint ffc_bigint_empty (void ) {
19652000 ffc_sv sv;
19662001 sv.len = 0 ;
2002+ #if defined(_MSC_VER) && !defined(__clang__)
2003+ ffc_bigint sv_bigint;
2004+ sv_bigint.vec = sv;
2005+ return sv_bigint;
2006+ #else
19672007 return (ffc_bigint){sv};
2008+ #endif
19682009}
19692010
19702011ffc_inline ffc_internal
@@ -1978,7 +2019,13 @@ ffc_bigint ffc_bigint_make(uint64_t value) {
19782019 ffc_sv_push_unchecked (&sv, (uint32_t )(value >> 32 ));
19792020#endif
19802021 ffc_sv_normalize (&sv);
2022+ #if defined(_MSC_VER) && !defined(__clang__)
2023+ ffc_bigint sv_bigint;
2024+ sv_bigint.vec = sv;
2025+ return sv_bigint;
2026+ #else
19812027 return (ffc_bigint){sv};
2028+ #endif
19822029}
19832030
19842031// get the high 64 bits from the vector, and if bits were truncated.
@@ -2150,7 +2197,13 @@ ffc_internal ffc_inline
21502197bool ffc_bigint_pow5 (ffc_bigint* me, uint32_t exp) {
21512198 // multiply by a power of 5
21522199 size_t large_length = sizeof (ffc_large_power_of_5) / sizeof (ffc_bigint_limb);
2200+ #if _MSC_VER && !defined(__clang__)
2201+ ffc_bigint_limb_span large;
2202+ large.ptr = (ffc_bigint_limb*)ffc_large_power_of_5;
2203+ large.len = large_length;
2204+ #else
21532205 ffc_bigint_limb_span large = (ffc_bigint_limb_span){ .ptr = (ffc_bigint_limb*)ffc_large_power_of_5, .len = large_length};
2206+ #endif
21542207 while (exp >= pow5_tables_large_step) {
21552208 FFC_TRY (ffc_bigint_large_mul (&me->vec , large));
21562209 exp -= pow5_tables_large_step;
0 commit comments