зеркало из https://github.com/github/ruby.git
memory_view.c: Fix endianness of n, N, v, V
This commit is contained in:
Родитель
e8cee4915b
Коммит
c0de997edd
|
@ -473,10 +473,14 @@ rb_memory_view_parse_item_format(const char *format,
|
|||
switch (type_char) {
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'v':
|
||||
case 'V':
|
||||
little_endian_p = true;
|
||||
break;
|
||||
case 'g':
|
||||
case 'G':
|
||||
case 'n':
|
||||
case 'N':
|
||||
little_endian_p = false;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -93,8 +93,8 @@ class TestMemoryView < Test::Unit::TestCase
|
|||
["S", false, NATIVE_ENDIAN, SHORT_ALIGNMENT, sizeof(:short), 1],
|
||||
["s!", true, NATIVE_ENDIAN, SHORT_ALIGNMENT, sizeof(:short), 1],
|
||||
["S!", true, NATIVE_ENDIAN, SHORT_ALIGNMENT, sizeof(:short), 1],
|
||||
["n", false, NATIVE_ENDIAN, INT16_ALIGNMENT, sizeof(:int16_t), 1],
|
||||
["v", false, NATIVE_ENDIAN, INT16_ALIGNMENT, sizeof(:int16_t), 1],
|
||||
["n", false, :big_endian, INT16_ALIGNMENT, sizeof(:int16_t), 1],
|
||||
["v", false, :little_endian, INT16_ALIGNMENT, sizeof(:int16_t), 1],
|
||||
["i", false, NATIVE_ENDIAN, INT_ALIGNMENT, sizeof(:int), 1],
|
||||
["I", false, NATIVE_ENDIAN, INT_ALIGNMENT, sizeof(:int), 1],
|
||||
["i!", true, NATIVE_ENDIAN, INT_ALIGNMENT, sizeof(:int), 1],
|
||||
|
@ -103,8 +103,8 @@ class TestMemoryView < Test::Unit::TestCase
|
|||
["L", false, NATIVE_ENDIAN, INT32_ALIGNMENT, sizeof(:int32_t), 1],
|
||||
["l!", true, NATIVE_ENDIAN, LONG_ALIGNMENT, sizeof(:long), 1],
|
||||
["L!", true, NATIVE_ENDIAN, LONG_ALIGNMENT, sizeof(:long), 1],
|
||||
["N", false, NATIVE_ENDIAN, INT32_ALIGNMENT, sizeof(:int32_t), 1],
|
||||
["V", false, NATIVE_ENDIAN, INT32_ALIGNMENT, sizeof(:int32_t), 1],
|
||||
["N", false, :big_endian, INT32_ALIGNMENT, sizeof(:int32_t), 1],
|
||||
["V", false, :little_endian, INT32_ALIGNMENT, sizeof(:int32_t), 1],
|
||||
["f", false, NATIVE_ENDIAN, FLOAT_ALIGNMENT, sizeof(:float), 1],
|
||||
["e", false, :little_endian, FLOAT_ALIGNMENT, sizeof(:float), 1],
|
||||
["g", false, :big_endian, FLOAT_ALIGNMENT, sizeof(:float), 1],
|
||||
|
|
Загрузка…
Ссылка в новой задаче