added big endian data type variants (UIR for UIN, SIR for SIN, FLR for FLT, ULR for ULG, SLR for SLG)

This commit is contained in:
john30
2015-12-13 13:37:19 +01:00
parent 752475ef5f
commit 79cbd5649b
2 changed files with 41 additions and 5 deletions
+10 -5
View File
@@ -66,13 +66,18 @@ static const dataType_t dataTypes[] = {
{"SCH", 8, bt_num, SIG, 0x80, 0x81, 0x7f, 1}, // signed integer, -127 - +127
{"D1B", 8, bt_num, SIG, 0x80, 0x81, 0x7f, 1}, // signed integer, -127 - +127
{"D1C", 8, bt_num, 0, 0xff, 0x00, 0xc8, 2}, // unsigned number (fraction 1/2), 0 - 100 (0x00 - 0xc8, replacement 0xff)
{"UIN", 16, bt_num, LST, 0xffff, 0, 0xfffe, 1}, // unsigned integer, 0 - 65534
{"SIN", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 1}, // signed integer, -32767 - +32767
{"FLT", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 1000}, // signed number (fraction 1/1000), -32.767 - +32.767
{"D2B", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 256}, // signed number (fraction 1/256), -127.99 - +127.99
{"D2C", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 16}, // signed number (fraction 1/16), -2047.9 - +2047.9
{"ULG", 32, bt_num, LST, 0xffffffff, 0, 0xfffffffe, 1}, // unsigned integer, 0 - 4294967294
{"SLG", 32, bt_num, SIG, 0x80000000, 0x80000001, 0xffffffff, 1}, // signed integer, -2147483647 - +2147483647
{"FLT", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 1000}, // signed number (fraction 1/1000), -32.767 - +32.767, little endian
{"FLR", 16, bt_num, SIG|REV, 0x8000, 0x8001, 0x7fff, 1000}, // signed number (fraction 1/1000), -32.767 - +32.767, big endian
{"UIN", 16, bt_num, LST, 0xffff, 0, 0xfffe, 1}, // unsigned integer, 0 - 65534, little endian
{"UIR", 16, bt_num, LST|REV, 0xffff, 0, 0xfffe, 1}, // unsigned integer, 0 - 65534, big endian
{"SIN", 16, bt_num, SIG, 0x8000, 0x8001, 0x7fff, 1}, // signed integer, -32767 - +32767, little endian
{"SIR", 16, bt_num, SIG|REV, 0x8000, 0x8001, 0x7fff, 1}, // signed integer, -32767 - +32767, big endian
{"ULG", 32, bt_num, LST, 0xffffffff, 0, 0xfffffffe, 1}, // unsigned integer, 0 - 4294967294, little endian
{"ULR", 32, bt_num, LST|REV, 0xffffffff, 0, 0xfffffffe, 1}, // unsigned integer, 0 - 4294967294, big endian
{"SLG", 32, bt_num, SIG, 0x80000000, 0x80000001, 0xffffffff, 1}, // signed integer, -2147483647 - +2147483647, little endian
{"SLR", 32, bt_num, SIG|REV, 0x80000000, 0x80000001, 0xffffffff, 1}, // signed integer, -2147483647 - +2147483647, big endian
{"BI0", 7, bt_num, ADJ|LST|REQ, 0, 0, 0xef, 0}, // bit 0 (up to 7 bits until bit 6)
{"BI1", 7, bt_num, ADJ|LST|REQ, 0, 0, 0x7f, 1}, // bit 1 (up to 7 bits until bit 7)
{"BI2", 6, bt_num, ADJ|LST|REQ, 0, 0, 0x3f, 2}, // bit 2 (up to 6 bits until bit 7)
+31
View File
@@ -184,6 +184,12 @@ int main()
{"x,,uin", "-", "10feffff02ffff", "00", ""},
{"x,,uin,10", "3.8", "10feffff022600", "00", ""},
{"x,,uin,-10","380", "10feffff022600", "00", ""},
{"x,,uir", "38", "10feffff020026", "00", ""},
{"x,,uir", "0", "10feffff020000", "00", ""},
{"x,,uir", "65534", "10feffff02fffe", "00", ""},
{"x,,uir", "-", "10feffff02ffff", "00", ""},
{"x,,uir,10", "3.8", "10feffff020026", "00", ""},
{"x,,uir,-10","380", "10feffff020026", "00", ""},
{"uin10,uin,-10","", "", "", "t"}, // template
{"x,,uin10","380", "10feffff022600", "00", ""}, // template reference
{"x,,uin10,-10","3800","10feffff022600", "00", ""}, // template reference, valid divider product
@@ -196,12 +202,26 @@ int main()
{"x,,sin", "32767", "10feffff02ff7f", "00", ""},
{"x,,sin,10","-9.0", "10feffff02a6ff", "00", ""},
{"x,,sin,-10","-900","10feffff02a6ff", "00", ""},
{"x,,sir", "-90", "10feffff02ffa6", "00", ""},
{"x,,sir", "0", "10feffff020000", "00", ""},
{"x,,sir", "-1", "10feffff02ffff", "00", ""},
{"x,,sir", "-", "10feffff028000", "00", ""},
{"x,,sir", "-32767", "10feffff028001", "00", ""},
{"x,,sir", "32767", "10feffff027fff", "00", ""},
{"x,,sir,10","-9.0", "10feffff02ffa6", "00", ""},
{"x,,sir,-10","-900","10feffff02ffa6", "00", ""},
{"x,,flt", "-0.090", "10feffff02a6ff", "00", ""},
{"x,,flt", "0.000", "10feffff020000", "00", ""},
{"x,,flt", "-0.001", "10feffff02ffff", "00", ""},
{"x,,flt", "-", "10feffff020080", "00", ""},
{"x,,flt","-32.767", "10feffff020180", "00", ""},
{"x,,flt", "32.767", "10feffff02ff7f", "00", ""},
{"x,,flr", "-0.090", "10feffff02ffa6", "00", ""},
{"x,,flr", "0.000", "10feffff020000", "00", ""},
{"x,,flr", "-0.001", "10feffff02ffff", "00", ""},
{"x,,flr", "-", "10feffff028000", "00", ""},
{"x,,flr","-32.767", "10feffff028001", "00", ""},
{"x,,flr", "32.767", "10feffff027fff", "00", ""},
{"x,,d2b", "18.004", "10fe0700090112", "00", ""},
{"x,,d2b", "0.000", "10feffff020000", "00", ""},
{"x,,d2b", "-0.004", "10feffff02ffff", "00", ""},
@@ -220,11 +240,22 @@ int main()
{"x,,ulg", "-", "10feffff04ffffffff", "00", ""},
{"x,,ulg,10","3.8", "10feffff0426000000", "00", ""},
{"x,,ulg,-10","380", "10feffff0426000000", "00", ""},
{"x,,ulr", "38", "10feffff0400000026", "00", ""},
{"x,,ulr", "0", "10feffff0400000000", "00", ""},
{"x,,ulr", "4294967294", "10feffff04fffffffe", "00", ""},
{"x,,ulr", "-", "10feffff04ffffffff", "00", ""},
{"x,,ulr,10","3.8", "10feffff0400000026", "00", ""},
{"x,,ulr,-10","380", "10feffff0400000026", "00", ""},
{"x,,slg", "-90", "10feffff04a6ffffff", "00", ""},
{"x,,slg", "0", "10feffff0400000000", "00", ""},
{"x,,slg", "-1", "10feffff04ffffffff", "00", ""},
{"x,,slg,10", "-9.0", "10feffff04a6ffffff", "00", ""},
{"x,,slg,-10", "-900", "10feffff04a6ffffff", "00", ""},
{"x,,slr", "-90", "10feffff04ffffffa6", "00", ""},
{"x,,slr", "0", "10feffff0400000000", "00", ""},
{"x,,slr", "-1", "10feffff04ffffffff", "00", ""},
{"x,,slr,10", "-9.0", "10feffff04ffffffa6", "00", ""},
{"x,,slr,-10", "-900", "10feffff04ffffffa6", "00", ""},
{"x,,bi3", "1", "10feffff0108", "00", ""},
{"x,,bi3", "0", "10feffff0100", "00", ""},
{"x,,bi3,0=off;1=on","on", "10feffff0108", "00", ""},