We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83b95f2 commit 042da83Copy full SHA for 042da83
inline.h
@@ -2055,8 +2055,20 @@ Perl_variant_byte_number(PERL_UINTMAX_T word)
2055
2056
return (unsigned int) word;
2057
2058
-# else
2059
-# error Unexpected byte order
+#else /* Unhandled byte-order; the compiler knows which comes first */
+
2060
+ const U8 * bytes = (U8 *) &word;
2061
+ for (unsigned int i = 0; i < sizeof(word); i++) {
2062
+ if (bytes[i]) {
2063
+ return i;
2064
+ }
2065
2066
2067
+ assert(0);
2068
2069
+ /* If all else fails, it's better to return something than just random */
2070
+ return 0;
2071
2072
# endif
2073
2074
}
0 commit comments