xvr 12 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 19 hours ago, jcxz said: где тут требуемое выходное 64-битное значение? Где? Вижу только result, который очевидно имеет разрядность = 8. Вы читать умеете? Я же писал пару постов назад: On 4/22/2022 at 4:50 PM, xvr said: uint64_t t0...7[256] вас спасёт. Так что result 64 бита, или 8 байтов (для тех, кто не умеет считать) 19 hours ago, jcxz said: Массив такого размера нужен для вашего метода. Не нужен, об этом я тоже писал 19 hours ago, jcxz said: Что именно предлагается? где?? Код в студию! Гм, ещё раз? Quote Входные данные - 8 байтов в виде 8 переменных b0, b1, ... b7 таблицы перекодировок - 8 штук типа uint64_t t0/1/.../7[256]={...} Перекодировка: result = t0[b0] | t1[b1] | t2[b2] | ... t7[b7]; ЭТО ВЕСЬ КОД! 19 hours ago, jcxz said: Пока что единственный работающий код привёл только я. Корона не жмёт? По вашим словам можно подумать, что во всём электрониксе только вы рабочие коды приводите 2 ТС: код и таблицы рабочие, можете брать, если хотите 2 jcxz: это магия, забейте Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
adnega 11 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба for(n = 0; n < 8; n++) { dst = &RAM_BIT_ADDR(&stat_video_digit[0], n_pos[n]); for(j = 0; j < VALUE_SIZE; j++) { src = &RAM_BIT_ADDR(&digit_video[n * VALUE_SIZE + j], 7); for(i = 0; i < 8; i++) { *dst = *src; src -= 1; dst += 8; } } } где #define VALUE_SIZE (4) // размер одного "вагончика" const BYTE n_pos[8] = {5, 7, 4, 6, 3, 1, 2, 0}; // таблица подключений В копилку рабочих кодов ;) Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
jcxz 234 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 3 часа назад, xvr сказал: Гм, ещё раз? Похоже бесполезно... Или до вас не доходит или троллите.... Рабочий код - это исходник, который ЛЮБОЙ может скомпилировать и проверить. Вот это: 21.04.2022 в 17:38, jcxz сказал: Не знаю о каком именно CPU речь и что такое "первые биты" и что такое "первый байт", но вот накидал для >= Cortex-M4: Скрыть содержимое SECTION .text:CODE:NOROOT(2) PUBLIC ResortBits ;extern "C" void ResortBits(u32 *, u32 const *, uint n); THUMB ResortBits: PUSH {R4-R6, LR} MOV R12, #80808080h ResortBits_01: LDMIA R1!, {R3, R4} USUB8 LR, R4, R12 MRS R6, APSR LSLS R4, R4, #1 LSLS R6, R6, #12 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #24, #4 USUB8 LR, R4, R12 MRS LR, APSR LSLS R4, R4, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #20, #4 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #16, #4 USUB8 LR, R4, R12 MRS LR, APSR LSLS R4, R4, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #12, #4 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #8, #4 USUB8 LR, R4, R12 MRS LR, APSR LSLS R4, R4, #1 UBFX LR, LR, #16, #4 BFI R6, LR, #4, #4 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX R5, LR, #16, #4 ORRS R6, R5 USUB8 LR, R4, R12 MRS R5, APSR LSLS R4, R4, #1 LSLS R5, R5, #12 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R5, LR, #24, #4 USUB8 LR, R4, R12 MRS LR, APSR LSLS R4, R4, #1 UBFX LR, LR, #16, #4 BFI R5, LR, #20, #4 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R5, LR, #16, #4 USUB8 LR, R4, R12 MRS LR, APSR LSLS R4, R4, #1 UBFX LR, LR, #16, #4 BFI R5, LR, #12, #4 USUB8 LR, R3, R12 MRS LR, APSR LSLS R3, R3, #1 UBFX LR, LR, #16, #4 BFI R5, LR, #8, #4 USUB8 LR, R4, R12 MRS LR, APSR UBFX LR, LR, #16, #4 BFI R5, LR, #4, #4 USUB8 LR, R3, R12 MRS LR, APSR UBFX R4, LR, #16, #4 ORRS R5, R4 SUBS R2, R2, #1 STMIA R0!, {R5, R6} BNE ResortBits_01 POP {R4-R6, PC} 1-аргумент ResortBits() - выходной буфер, 2-й - входные данные, 3й - кол-во входных данных (64-битных слов). Вх. и вых. буфера должны быть выравнены на 32 бита. Все 7-е биты помещаются в 7-й байт; 6-е биты - в 6-й байт и т.д. Внутри вых.байтов расположение битов аналогично - самый старший бит соответствует самому старшему вх.байту. и называется рабочим кодом. Исходник полный, все переменные и константы - описаны. А от вас кроме пустого звона до сих пор так ничего вразумительного и не было. PS: Дальнейшую дискуссию с вами прекращаю, так как вижу, что бессмысленно. Троллингом занимайтесь в другом месте. 2 часа назад, adnega сказал: for(n = 0; n < 8; n++) { dst = &RAM_BIT_ADDR(&stat_video_digit[0], n_pos[n]); for(j = 0; j < VALUE_SIZE; j++) { src = &RAM_BIT_ADDR(&digit_video[n * VALUE_SIZE + j], 7); for(i = 0; i < 8; i++) { *dst = *src; src -= 1; dst += 8; } } } где #define VALUE_SIZE (4) // размер одного "вагончика" const BYTE n_pos[8] = {5, 7, 4, 6, 3, 1, 2, 0}; // таблица подключений В копилку рабочих кодов ;) Код возможно и рабочий, но..... КРАЙНЕ медленный! Даже тупая в лоб перестановка битов с помощью ~64 пар инструкций UBFX/BFI - будет в разы быстрее. Только два цикла - внутренний и внешний дадут уже 64 прохода во внутреннем цикле. А один проход внутреннего цикла - это множество тактов. Так как требует: чтения исходного слова, чтения целевого слова, модификации бита в нём, записи целевого слова. Это не считая трат на организацию самих циклов. А UBFX/BFI = это всего 2 такта. Как уже писал: bit-band в этой задаче - самый медленный способ. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
xvr 12 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 29 minutes ago, jcxz said: Рабочий код - это исходник, который ЛЮБОЙ может скомпилировать и проверить. Т.е. вы не в состоянии завернуть строку кода в функцию и проверить? (Почему то я не удивлён) Держите: #include <stdint.h> static const uint64_t t0[] = { 0x0000000000000000ull,0x8000000000000000ull,0x4000000000000000ull,0xC000000000000000ull,0x2000000000000000ull,0xA000000000000000ull,0x6000000000000000ull,0xE000000000000000ull, 0x1000000000000000ull,0x9000000000000000ull,0x5000000000000000ull,0xD000000000000000ull,0x3000000000000000ull,0xB000000000000000ull,0x7000000000000000ull,0xF000000000000000ull, 0x0800000000000000ull,0x8800000000000000ull,0x4800000000000000ull,0xC800000000000000ull,0x2800000000000000ull,0xA800000000000000ull,0x6800000000000000ull,0xE800000000000000ull, 0x1800000000000000ull,0x9800000000000000ull,0x5800000000000000ull,0xD800000000000000ull,0x3800000000000000ull,0xB800000000000000ull,0x7800000000000000ull,0xF800000000000000ull, 0x0400000000000000ull,0x8400000000000000ull,0x4400000000000000ull,0xC400000000000000ull,0x2400000000000000ull,0xA400000000000000ull,0x6400000000000000ull,0xE400000000000000ull, 0x1400000000000000ull,0x9400000000000000ull,0x5400000000000000ull,0xD400000000000000ull,0x3400000000000000ull,0xB400000000000000ull,0x7400000000000000ull,0xF400000000000000ull, 0x0C00000000000000ull,0x8C00000000000000ull,0x4C00000000000000ull,0xCC00000000000000ull,0x2C00000000000000ull,0xAC00000000000000ull,0x6C00000000000000ull,0xEC00000000000000ull, 0x1C00000000000000ull,0x9C00000000000000ull,0x5C00000000000000ull,0xDC00000000000000ull,0x3C00000000000000ull,0xBC00000000000000ull,0x7C00000000000000ull,0xFC00000000000000ull, 0x0200000000000000ull,0x8200000000000000ull,0x4200000000000000ull,0xC200000000000000ull,0x2200000000000000ull,0xA200000000000000ull,0x6200000000000000ull,0xE200000000000000ull, 0x1200000000000000ull,0x9200000000000000ull,0x5200000000000000ull,0xD200000000000000ull,0x3200000000000000ull,0xB200000000000000ull,0x7200000000000000ull,0xF200000000000000ull, 0x0A00000000000000ull,0x8A00000000000000ull,0x4A00000000000000ull,0xCA00000000000000ull,0x2A00000000000000ull,0xAA00000000000000ull,0x6A00000000000000ull,0xEA00000000000000ull, 0x1A00000000000000ull,0x9A00000000000000ull,0x5A00000000000000ull,0xDA00000000000000ull,0x3A00000000000000ull,0xBA00000000000000ull,0x7A00000000000000ull,0xFA00000000000000ull, 0x0600000000000000ull,0x8600000000000000ull,0x4600000000000000ull,0xC600000000000000ull,0x2600000000000000ull,0xA600000000000000ull,0x6600000000000000ull,0xE600000000000000ull, 0x1600000000000000ull,0x9600000000000000ull,0x5600000000000000ull,0xD600000000000000ull,0x3600000000000000ull,0xB600000000000000ull,0x7600000000000000ull,0xF600000000000000ull, 0x0E00000000000000ull,0x8E00000000000000ull,0x4E00000000000000ull,0xCE00000000000000ull,0x2E00000000000000ull,0xAE00000000000000ull,0x6E00000000000000ull,0xEE00000000000000ull, 0x1E00000000000000ull,0x9E00000000000000ull,0x5E00000000000000ull,0xDE00000000000000ull,0x3E00000000000000ull,0xBE00000000000000ull,0x7E00000000000000ull,0xFE00000000000000ull, 0x0100000000000000ull,0x8100000000000000ull,0x4100000000000000ull,0xC100000000000000ull,0x2100000000000000ull,0xA100000000000000ull,0x6100000000000000ull,0xE100000000000000ull, 0x1100000000000000ull,0x9100000000000000ull,0x5100000000000000ull,0xD100000000000000ull,0x3100000000000000ull,0xB100000000000000ull,0x7100000000000000ull,0xF100000000000000ull, 0x0900000000000000ull,0x8900000000000000ull,0x4900000000000000ull,0xC900000000000000ull,0x2900000000000000ull,0xA900000000000000ull,0x6900000000000000ull,0xE900000000000000ull, 0x1900000000000000ull,0x9900000000000000ull,0x5900000000000000ull,0xD900000000000000ull,0x3900000000000000ull,0xB900000000000000ull,0x7900000000000000ull,0xF900000000000000ull, 0x0500000000000000ull,0x8500000000000000ull,0x4500000000000000ull,0xC500000000000000ull,0x2500000000000000ull,0xA500000000000000ull,0x6500000000000000ull,0xE500000000000000ull, 0x1500000000000000ull,0x9500000000000000ull,0x5500000000000000ull,0xD500000000000000ull,0x3500000000000000ull,0xB500000000000000ull,0x7500000000000000ull,0xF500000000000000ull, 0x0D00000000000000ull,0x8D00000000000000ull,0x4D00000000000000ull,0xCD00000000000000ull,0x2D00000000000000ull,0xAD00000000000000ull,0x6D00000000000000ull,0xED00000000000000ull, 0x1D00000000000000ull,0x9D00000000000000ull,0x5D00000000000000ull,0xDD00000000000000ull,0x3D00000000000000ull,0xBD00000000000000ull,0x7D00000000000000ull,0xFD00000000000000ull, 0x0300000000000000ull,0x8300000000000000ull,0x4300000000000000ull,0xC300000000000000ull,0x2300000000000000ull,0xA300000000000000ull,0x6300000000000000ull,0xE300000000000000ull, 0x1300000000000000ull,0x9300000000000000ull,0x5300000000000000ull,0xD300000000000000ull,0x3300000000000000ull,0xB300000000000000ull,0x7300000000000000ull,0xF300000000000000ull, 0x0B00000000000000ull,0x8B00000000000000ull,0x4B00000000000000ull,0xCB00000000000000ull,0x2B00000000000000ull,0xAB00000000000000ull,0x6B00000000000000ull,0xEB00000000000000ull, 0x1B00000000000000ull,0x9B00000000000000ull,0x5B00000000000000ull,0xDB00000000000000ull,0x3B00000000000000ull,0xBB00000000000000ull,0x7B00000000000000ull,0xFB00000000000000ull, 0x0700000000000000ull,0x8700000000000000ull,0x4700000000000000ull,0xC700000000000000ull,0x2700000000000000ull,0xA700000000000000ull,0x6700000000000000ull,0xE700000000000000ull, 0x1700000000000000ull,0x9700000000000000ull,0x5700000000000000ull,0xD700000000000000ull,0x3700000000000000ull,0xB700000000000000ull,0x7700000000000000ull,0xF700000000000000ull, 0x0F00000000000000ull,0x8F00000000000000ull,0x4F00000000000000ull,0xCF00000000000000ull,0x2F00000000000000ull,0xAF00000000000000ull,0x6F00000000000000ull,0xEF00000000000000ull, 0x1F00000000000000ull,0x9F00000000000000ull,0x5F00000000000000ull,0xDF00000000000000ull,0x3F00000000000000ull,0xBF00000000000000ull,0x7F00000000000000ull,0xFF00000000000000ull }; static const uint64_t t1[] = { 0x0000000000000000ull,0x0080000000000000ull,0x0040000000000000ull,0x00C0000000000000ull,0x0020000000000000ull,0x00A0000000000000ull,0x0060000000000000ull,0x00E0000000000000ull, 0x0010000000000000ull,0x0090000000000000ull,0x0050000000000000ull,0x00D0000000000000ull,0x0030000000000000ull,0x00B0000000000000ull,0x0070000000000000ull,0x00F0000000000000ull, 0x0008000000000000ull,0x0088000000000000ull,0x0048000000000000ull,0x00C8000000000000ull,0x0028000000000000ull,0x00A8000000000000ull,0x0068000000000000ull,0x00E8000000000000ull, 0x0018000000000000ull,0x0098000000000000ull,0x0058000000000000ull,0x00D8000000000000ull,0x0038000000000000ull,0x00B8000000000000ull,0x0078000000000000ull,0x00F8000000000000ull, 0x0004000000000000ull,0x0084000000000000ull,0x0044000000000000ull,0x00C4000000000000ull,0x0024000000000000ull,0x00A4000000000000ull,0x0064000000000000ull,0x00E4000000000000ull, 0x0014000000000000ull,0x0094000000000000ull,0x0054000000000000ull,0x00D4000000000000ull,0x0034000000000000ull,0x00B4000000000000ull,0x0074000000000000ull,0x00F4000000000000ull, 0x000C000000000000ull,0x008C000000000000ull,0x004C000000000000ull,0x00CC000000000000ull,0x002C000000000000ull,0x00AC000000000000ull,0x006C000000000000ull,0x00EC000000000000ull, 0x001C000000000000ull,0x009C000000000000ull,0x005C000000000000ull,0x00DC000000000000ull,0x003C000000000000ull,0x00BC000000000000ull,0x007C000000000000ull,0x00FC000000000000ull, 0x0002000000000000ull,0x0082000000000000ull,0x0042000000000000ull,0x00C2000000000000ull,0x0022000000000000ull,0x00A2000000000000ull,0x0062000000000000ull,0x00E2000000000000ull, 0x0012000000000000ull,0x0092000000000000ull,0x0052000000000000ull,0x00D2000000000000ull,0x0032000000000000ull,0x00B2000000000000ull,0x0072000000000000ull,0x00F2000000000000ull, 0x000A000000000000ull,0x008A000000000000ull,0x004A000000000000ull,0x00CA000000000000ull,0x002A000000000000ull,0x00AA000000000000ull,0x006A000000000000ull,0x00EA000000000000ull, 0x001A000000000000ull,0x009A000000000000ull,0x005A000000000000ull,0x00DA000000000000ull,0x003A000000000000ull,0x00BA000000000000ull,0x007A000000000000ull,0x00FA000000000000ull, 0x0006000000000000ull,0x0086000000000000ull,0x0046000000000000ull,0x00C6000000000000ull,0x0026000000000000ull,0x00A6000000000000ull,0x0066000000000000ull,0x00E6000000000000ull, 0x0016000000000000ull,0x0096000000000000ull,0x0056000000000000ull,0x00D6000000000000ull,0x0036000000000000ull,0x00B6000000000000ull,0x0076000000000000ull,0x00F6000000000000ull, 0x000E000000000000ull,0x008E000000000000ull,0x004E000000000000ull,0x00CE000000000000ull,0x002E000000000000ull,0x00AE000000000000ull,0x006E000000000000ull,0x00EE000000000000ull, 0x001E000000000000ull,0x009E000000000000ull,0x005E000000000000ull,0x00DE000000000000ull,0x003E000000000000ull,0x00BE000000000000ull,0x007E000000000000ull,0x00FE000000000000ull, 0x0001000000000000ull,0x0081000000000000ull,0x0041000000000000ull,0x00C1000000000000ull,0x0021000000000000ull,0x00A1000000000000ull,0x0061000000000000ull,0x00E1000000000000ull, 0x0011000000000000ull,0x0091000000000000ull,0x0051000000000000ull,0x00D1000000000000ull,0x0031000000000000ull,0x00B1000000000000ull,0x0071000000000000ull,0x00F1000000000000ull, 0x0009000000000000ull,0x0089000000000000ull,0x0049000000000000ull,0x00C9000000000000ull,0x0029000000000000ull,0x00A9000000000000ull,0x0069000000000000ull,0x00E9000000000000ull, 0x0019000000000000ull,0x0099000000000000ull,0x0059000000000000ull,0x00D9000000000000ull,0x0039000000000000ull,0x00B9000000000000ull,0x0079000000000000ull,0x00F9000000000000ull, 0x0005000000000000ull,0x0085000000000000ull,0x0045000000000000ull,0x00C5000000000000ull,0x0025000000000000ull,0x00A5000000000000ull,0x0065000000000000ull,0x00E5000000000000ull, 0x0015000000000000ull,0x0095000000000000ull,0x0055000000000000ull,0x00D5000000000000ull,0x0035000000000000ull,0x00B5000000000000ull,0x0075000000000000ull,0x00F5000000000000ull, 0x000D000000000000ull,0x008D000000000000ull,0x004D000000000000ull,0x00CD000000000000ull,0x002D000000000000ull,0x00AD000000000000ull,0x006D000000000000ull,0x00ED000000000000ull, 0x001D000000000000ull,0x009D000000000000ull,0x005D000000000000ull,0x00DD000000000000ull,0x003D000000000000ull,0x00BD000000000000ull,0x007D000000000000ull,0x00FD000000000000ull, 0x0003000000000000ull,0x0083000000000000ull,0x0043000000000000ull,0x00C3000000000000ull,0x0023000000000000ull,0x00A3000000000000ull,0x0063000000000000ull,0x00E3000000000000ull, 0x0013000000000000ull,0x0093000000000000ull,0x0053000000000000ull,0x00D3000000000000ull,0x0033000000000000ull,0x00B3000000000000ull,0x0073000000000000ull,0x00F3000000000000ull, 0x000B000000000000ull,0x008B000000000000ull,0x004B000000000000ull,0x00CB000000000000ull,0x002B000000000000ull,0x00AB000000000000ull,0x006B000000000000ull,0x00EB000000000000ull, 0x001B000000000000ull,0x009B000000000000ull,0x005B000000000000ull,0x00DB000000000000ull,0x003B000000000000ull,0x00BB000000000000ull,0x007B000000000000ull,0x00FB000000000000ull, 0x0007000000000000ull,0x0087000000000000ull,0x0047000000000000ull,0x00C7000000000000ull,0x0027000000000000ull,0x00A7000000000000ull,0x0067000000000000ull,0x00E7000000000000ull, 0x0017000000000000ull,0x0097000000000000ull,0x0057000000000000ull,0x00D7000000000000ull,0x0037000000000000ull,0x00B7000000000000ull,0x0077000000000000ull,0x00F7000000000000ull, 0x000F000000000000ull,0x008F000000000000ull,0x004F000000000000ull,0x00CF000000000000ull,0x002F000000000000ull,0x00AF000000000000ull,0x006F000000000000ull,0x00EF000000000000ull, 0x001F000000000000ull,0x009F000000000000ull,0x005F000000000000ull,0x00DF000000000000ull,0x003F000000000000ull,0x00BF000000000000ull,0x007F000000000000ull,0x00FF000000000000ull }; static const uint64_t t2[] = { 0x0000000000000000ull,0x0000800000000000ull,0x0000400000000000ull,0x0000C00000000000ull,0x0000200000000000ull,0x0000A00000000000ull,0x0000600000000000ull,0x0000E00000000000ull, 0x0000100000000000ull,0x0000900000000000ull,0x0000500000000000ull,0x0000D00000000000ull,0x0000300000000000ull,0x0000B00000000000ull,0x0000700000000000ull,0x0000F00000000000ull, 0x0000080000000000ull,0x0000880000000000ull,0x0000480000000000ull,0x0000C80000000000ull,0x0000280000000000ull,0x0000A80000000000ull,0x0000680000000000ull,0x0000E80000000000ull, 0x0000180000000000ull,0x0000980000000000ull,0x0000580000000000ull,0x0000D80000000000ull,0x0000380000000000ull,0x0000B80000000000ull,0x0000780000000000ull,0x0000F80000000000ull, 0x0000040000000000ull,0x0000840000000000ull,0x0000440000000000ull,0x0000C40000000000ull,0x0000240000000000ull,0x0000A40000000000ull,0x0000640000000000ull,0x0000E40000000000ull, 0x0000140000000000ull,0x0000940000000000ull,0x0000540000000000ull,0x0000D40000000000ull,0x0000340000000000ull,0x0000B40000000000ull,0x0000740000000000ull,0x0000F40000000000ull, 0x00000C0000000000ull,0x00008C0000000000ull,0x00004C0000000000ull,0x0000CC0000000000ull,0x00002C0000000000ull,0x0000AC0000000000ull,0x00006C0000000000ull,0x0000EC0000000000ull, 0x00001C0000000000ull,0x00009C0000000000ull,0x00005C0000000000ull,0x0000DC0000000000ull,0x00003C0000000000ull,0x0000BC0000000000ull,0x00007C0000000000ull,0x0000FC0000000000ull, 0x0000020000000000ull,0x0000820000000000ull,0x0000420000000000ull,0x0000C20000000000ull,0x0000220000000000ull,0x0000A20000000000ull,0x0000620000000000ull,0x0000E20000000000ull, 0x0000120000000000ull,0x0000920000000000ull,0x0000520000000000ull,0x0000D20000000000ull,0x0000320000000000ull,0x0000B20000000000ull,0x0000720000000000ull,0x0000F20000000000ull, 0x00000A0000000000ull,0x00008A0000000000ull,0x00004A0000000000ull,0x0000CA0000000000ull,0x00002A0000000000ull,0x0000AA0000000000ull,0x00006A0000000000ull,0x0000EA0000000000ull, 0x00001A0000000000ull,0x00009A0000000000ull,0x00005A0000000000ull,0x0000DA0000000000ull,0x00003A0000000000ull,0x0000BA0000000000ull,0x00007A0000000000ull,0x0000FA0000000000ull, 0x0000060000000000ull,0x0000860000000000ull,0x0000460000000000ull,0x0000C60000000000ull,0x0000260000000000ull,0x0000A60000000000ull,0x0000660000000000ull,0x0000E60000000000ull, 0x0000160000000000ull,0x0000960000000000ull,0x0000560000000000ull,0x0000D60000000000ull,0x0000360000000000ull,0x0000B60000000000ull,0x0000760000000000ull,0x0000F60000000000ull, 0x00000E0000000000ull,0x00008E0000000000ull,0x00004E0000000000ull,0x0000CE0000000000ull,0x00002E0000000000ull,0x0000AE0000000000ull,0x00006E0000000000ull,0x0000EE0000000000ull, 0x00001E0000000000ull,0x00009E0000000000ull,0x00005E0000000000ull,0x0000DE0000000000ull,0x00003E0000000000ull,0x0000BE0000000000ull,0x00007E0000000000ull,0x0000FE0000000000ull, 0x0000010000000000ull,0x0000810000000000ull,0x0000410000000000ull,0x0000C10000000000ull,0x0000210000000000ull,0x0000A10000000000ull,0x0000610000000000ull,0x0000E10000000000ull, 0x0000110000000000ull,0x0000910000000000ull,0x0000510000000000ull,0x0000D10000000000ull,0x0000310000000000ull,0x0000B10000000000ull,0x0000710000000000ull,0x0000F10000000000ull, 0x0000090000000000ull,0x0000890000000000ull,0x0000490000000000ull,0x0000C90000000000ull,0x0000290000000000ull,0x0000A90000000000ull,0x0000690000000000ull,0x0000E90000000000ull, 0x0000190000000000ull,0x0000990000000000ull,0x0000590000000000ull,0x0000D90000000000ull,0x0000390000000000ull,0x0000B90000000000ull,0x0000790000000000ull,0x0000F90000000000ull, 0x0000050000000000ull,0x0000850000000000ull,0x0000450000000000ull,0x0000C50000000000ull,0x0000250000000000ull,0x0000A50000000000ull,0x0000650000000000ull,0x0000E50000000000ull, 0x0000150000000000ull,0x0000950000000000ull,0x0000550000000000ull,0x0000D50000000000ull,0x0000350000000000ull,0x0000B50000000000ull,0x0000750000000000ull,0x0000F50000000000ull, 0x00000D0000000000ull,0x00008D0000000000ull,0x00004D0000000000ull,0x0000CD0000000000ull,0x00002D0000000000ull,0x0000AD0000000000ull,0x00006D0000000000ull,0x0000ED0000000000ull, 0x00001D0000000000ull,0x00009D0000000000ull,0x00005D0000000000ull,0x0000DD0000000000ull,0x00003D0000000000ull,0x0000BD0000000000ull,0x00007D0000000000ull,0x0000FD0000000000ull, 0x0000030000000000ull,0x0000830000000000ull,0x0000430000000000ull,0x0000C30000000000ull,0x0000230000000000ull,0x0000A30000000000ull,0x0000630000000000ull,0x0000E30000000000ull, 0x0000130000000000ull,0x0000930000000000ull,0x0000530000000000ull,0x0000D30000000000ull,0x0000330000000000ull,0x0000B30000000000ull,0x0000730000000000ull,0x0000F30000000000ull, 0x00000B0000000000ull,0x00008B0000000000ull,0x00004B0000000000ull,0x0000CB0000000000ull,0x00002B0000000000ull,0x0000AB0000000000ull,0x00006B0000000000ull,0x0000EB0000000000ull, 0x00001B0000000000ull,0x00009B0000000000ull,0x00005B0000000000ull,0x0000DB0000000000ull,0x00003B0000000000ull,0x0000BB0000000000ull,0x00007B0000000000ull,0x0000FB0000000000ull, 0x0000070000000000ull,0x0000870000000000ull,0x0000470000000000ull,0x0000C70000000000ull,0x0000270000000000ull,0x0000A70000000000ull,0x0000670000000000ull,0x0000E70000000000ull, 0x0000170000000000ull,0x0000970000000000ull,0x0000570000000000ull,0x0000D70000000000ull,0x0000370000000000ull,0x0000B70000000000ull,0x0000770000000000ull,0x0000F70000000000ull, 0x00000F0000000000ull,0x00008F0000000000ull,0x00004F0000000000ull,0x0000CF0000000000ull,0x00002F0000000000ull,0x0000AF0000000000ull,0x00006F0000000000ull,0x0000EF0000000000ull, 0x00001F0000000000ull,0x00009F0000000000ull,0x00005F0000000000ull,0x0000DF0000000000ull,0x00003F0000000000ull,0x0000BF0000000000ull,0x00007F0000000000ull,0x0000FF0000000000ull }; static const uint64_t t3[] = { 0x0000000000000000ull,0x0000008000000000ull,0x0000004000000000ull,0x000000C000000000ull,0x0000002000000000ull,0x000000A000000000ull,0x0000006000000000ull,0x000000E000000000ull, 0x0000001000000000ull,0x0000009000000000ull,0x0000005000000000ull,0x000000D000000000ull,0x0000003000000000ull,0x000000B000000000ull,0x0000007000000000ull,0x000000F000000000ull, 0x0000000800000000ull,0x0000008800000000ull,0x0000004800000000ull,0x000000C800000000ull,0x0000002800000000ull,0x000000A800000000ull,0x0000006800000000ull,0x000000E800000000ull, 0x0000001800000000ull,0x0000009800000000ull,0x0000005800000000ull,0x000000D800000000ull,0x0000003800000000ull,0x000000B800000000ull,0x0000007800000000ull,0x000000F800000000ull, 0x0000000400000000ull,0x0000008400000000ull,0x0000004400000000ull,0x000000C400000000ull,0x0000002400000000ull,0x000000A400000000ull,0x0000006400000000ull,0x000000E400000000ull, 0x0000001400000000ull,0x0000009400000000ull,0x0000005400000000ull,0x000000D400000000ull,0x0000003400000000ull,0x000000B400000000ull,0x0000007400000000ull,0x000000F400000000ull, 0x0000000C00000000ull,0x0000008C00000000ull,0x0000004C00000000ull,0x000000CC00000000ull,0x0000002C00000000ull,0x000000AC00000000ull,0x0000006C00000000ull,0x000000EC00000000ull, 0x0000001C00000000ull,0x0000009C00000000ull,0x0000005C00000000ull,0x000000DC00000000ull,0x0000003C00000000ull,0x000000BC00000000ull,0x0000007C00000000ull,0x000000FC00000000ull, 0x0000000200000000ull,0x0000008200000000ull,0x0000004200000000ull,0x000000C200000000ull,0x0000002200000000ull,0x000000A200000000ull,0x0000006200000000ull,0x000000E200000000ull, 0x0000001200000000ull,0x0000009200000000ull,0x0000005200000000ull,0x000000D200000000ull,0x0000003200000000ull,0x000000B200000000ull,0x0000007200000000ull,0x000000F200000000ull, 0x0000000A00000000ull,0x0000008A00000000ull,0x0000004A00000000ull,0x000000CA00000000ull,0x0000002A00000000ull,0x000000AA00000000ull,0x0000006A00000000ull,0x000000EA00000000ull, 0x0000001A00000000ull,0x0000009A00000000ull,0x0000005A00000000ull,0x000000DA00000000ull,0x0000003A00000000ull,0x000000BA00000000ull,0x0000007A00000000ull,0x000000FA00000000ull, 0x0000000600000000ull,0x0000008600000000ull,0x0000004600000000ull,0x000000C600000000ull,0x0000002600000000ull,0x000000A600000000ull,0x0000006600000000ull,0x000000E600000000ull, 0x0000001600000000ull,0x0000009600000000ull,0x0000005600000000ull,0x000000D600000000ull,0x0000003600000000ull,0x000000B600000000ull,0x0000007600000000ull,0x000000F600000000ull, 0x0000000E00000000ull,0x0000008E00000000ull,0x0000004E00000000ull,0x000000CE00000000ull,0x0000002E00000000ull,0x000000AE00000000ull,0x0000006E00000000ull,0x000000EE00000000ull, 0x0000001E00000000ull,0x0000009E00000000ull,0x0000005E00000000ull,0x000000DE00000000ull,0x0000003E00000000ull,0x000000BE00000000ull,0x0000007E00000000ull,0x000000FE00000000ull, 0x0000000100000000ull,0x0000008100000000ull,0x0000004100000000ull,0x000000C100000000ull,0x0000002100000000ull,0x000000A100000000ull,0x0000006100000000ull,0x000000E100000000ull, 0x0000001100000000ull,0x0000009100000000ull,0x0000005100000000ull,0x000000D100000000ull,0x0000003100000000ull,0x000000B100000000ull,0x0000007100000000ull,0x000000F100000000ull, 0x0000000900000000ull,0x0000008900000000ull,0x0000004900000000ull,0x000000C900000000ull,0x0000002900000000ull,0x000000A900000000ull,0x0000006900000000ull,0x000000E900000000ull, 0x0000001900000000ull,0x0000009900000000ull,0x0000005900000000ull,0x000000D900000000ull,0x0000003900000000ull,0x000000B900000000ull,0x0000007900000000ull,0x000000F900000000ull, 0x0000000500000000ull,0x0000008500000000ull,0x0000004500000000ull,0x000000C500000000ull,0x0000002500000000ull,0x000000A500000000ull,0x0000006500000000ull,0x000000E500000000ull, 0x0000001500000000ull,0x0000009500000000ull,0x0000005500000000ull,0x000000D500000000ull,0x0000003500000000ull,0x000000B500000000ull,0x0000007500000000ull,0x000000F500000000ull, 0x0000000D00000000ull,0x0000008D00000000ull,0x0000004D00000000ull,0x000000CD00000000ull,0x0000002D00000000ull,0x000000AD00000000ull,0x0000006D00000000ull,0x000000ED00000000ull, 0x0000001D00000000ull,0x0000009D00000000ull,0x0000005D00000000ull,0x000000DD00000000ull,0x0000003D00000000ull,0x000000BD00000000ull,0x0000007D00000000ull,0x000000FD00000000ull, 0x0000000300000000ull,0x0000008300000000ull,0x0000004300000000ull,0x000000C300000000ull,0x0000002300000000ull,0x000000A300000000ull,0x0000006300000000ull,0x000000E300000000ull, 0x0000001300000000ull,0x0000009300000000ull,0x0000005300000000ull,0x000000D300000000ull,0x0000003300000000ull,0x000000B300000000ull,0x0000007300000000ull,0x000000F300000000ull, 0x0000000B00000000ull,0x0000008B00000000ull,0x0000004B00000000ull,0x000000CB00000000ull,0x0000002B00000000ull,0x000000AB00000000ull,0x0000006B00000000ull,0x000000EB00000000ull, 0x0000001B00000000ull,0x0000009B00000000ull,0x0000005B00000000ull,0x000000DB00000000ull,0x0000003B00000000ull,0x000000BB00000000ull,0x0000007B00000000ull,0x000000FB00000000ull, 0x0000000700000000ull,0x0000008700000000ull,0x0000004700000000ull,0x000000C700000000ull,0x0000002700000000ull,0x000000A700000000ull,0x0000006700000000ull,0x000000E700000000ull, 0x0000001700000000ull,0x0000009700000000ull,0x0000005700000000ull,0x000000D700000000ull,0x0000003700000000ull,0x000000B700000000ull,0x0000007700000000ull,0x000000F700000000ull, 0x0000000F00000000ull,0x0000008F00000000ull,0x0000004F00000000ull,0x000000CF00000000ull,0x0000002F00000000ull,0x000000AF00000000ull,0x0000006F00000000ull,0x000000EF00000000ull, 0x0000001F00000000ull,0x0000009F00000000ull,0x0000005F00000000ull,0x000000DF00000000ull,0x0000003F00000000ull,0x000000BF00000000ull,0x0000007F00000000ull,0x000000FF00000000ull }; static const uint64_t t4[] = { 0x0000000000000000ull,0x0000000080000000ull,0x0000000040000000ull,0x00000000C0000000ull,0x0000000020000000ull,0x00000000A0000000ull,0x0000000060000000ull,0x00000000E0000000ull, 0x0000000010000000ull,0x0000000090000000ull,0x0000000050000000ull,0x00000000D0000000ull,0x0000000030000000ull,0x00000000B0000000ull,0x0000000070000000ull,0x00000000F0000000ull, 0x0000000008000000ull,0x0000000088000000ull,0x0000000048000000ull,0x00000000C8000000ull,0x0000000028000000ull,0x00000000A8000000ull,0x0000000068000000ull,0x00000000E8000000ull, 0x0000000018000000ull,0x0000000098000000ull,0x0000000058000000ull,0x00000000D8000000ull,0x0000000038000000ull,0x00000000B8000000ull,0x0000000078000000ull,0x00000000F8000000ull, 0x0000000004000000ull,0x0000000084000000ull,0x0000000044000000ull,0x00000000C4000000ull,0x0000000024000000ull,0x00000000A4000000ull,0x0000000064000000ull,0x00000000E4000000ull, 0x0000000014000000ull,0x0000000094000000ull,0x0000000054000000ull,0x00000000D4000000ull,0x0000000034000000ull,0x00000000B4000000ull,0x0000000074000000ull,0x00000000F4000000ull, 0x000000000C000000ull,0x000000008C000000ull,0x000000004C000000ull,0x00000000CC000000ull,0x000000002C000000ull,0x00000000AC000000ull,0x000000006C000000ull,0x00000000EC000000ull, 0x000000001C000000ull,0x000000009C000000ull,0x000000005C000000ull,0x00000000DC000000ull,0x000000003C000000ull,0x00000000BC000000ull,0x000000007C000000ull,0x00000000FC000000ull, 0x0000000002000000ull,0x0000000082000000ull,0x0000000042000000ull,0x00000000C2000000ull,0x0000000022000000ull,0x00000000A2000000ull,0x0000000062000000ull,0x00000000E2000000ull, 0x0000000012000000ull,0x0000000092000000ull,0x0000000052000000ull,0x00000000D2000000ull,0x0000000032000000ull,0x00000000B2000000ull,0x0000000072000000ull,0x00000000F2000000ull, 0x000000000A000000ull,0x000000008A000000ull,0x000000004A000000ull,0x00000000CA000000ull,0x000000002A000000ull,0x00000000AA000000ull,0x000000006A000000ull,0x00000000EA000000ull, 0x000000001A000000ull,0x000000009A000000ull,0x000000005A000000ull,0x00000000DA000000ull,0x000000003A000000ull,0x00000000BA000000ull,0x000000007A000000ull,0x00000000FA000000ull, 0x0000000006000000ull,0x0000000086000000ull,0x0000000046000000ull,0x00000000C6000000ull,0x0000000026000000ull,0x00000000A6000000ull,0x0000000066000000ull,0x00000000E6000000ull, 0x0000000016000000ull,0x0000000096000000ull,0x0000000056000000ull,0x00000000D6000000ull,0x0000000036000000ull,0x00000000B6000000ull,0x0000000076000000ull,0x00000000F6000000ull, 0x000000000E000000ull,0x000000008E000000ull,0x000000004E000000ull,0x00000000CE000000ull,0x000000002E000000ull,0x00000000AE000000ull,0x000000006E000000ull,0x00000000EE000000ull, 0x000000001E000000ull,0x000000009E000000ull,0x000000005E000000ull,0x00000000DE000000ull,0x000000003E000000ull,0x00000000BE000000ull,0x000000007E000000ull,0x00000000FE000000ull, 0x0000000001000000ull,0x0000000081000000ull,0x0000000041000000ull,0x00000000C1000000ull,0x0000000021000000ull,0x00000000A1000000ull,0x0000000061000000ull,0x00000000E1000000ull, 0x0000000011000000ull,0x0000000091000000ull,0x0000000051000000ull,0x00000000D1000000ull,0x0000000031000000ull,0x00000000B1000000ull,0x0000000071000000ull,0x00000000F1000000ull, 0x0000000009000000ull,0x0000000089000000ull,0x0000000049000000ull,0x00000000C9000000ull,0x0000000029000000ull,0x00000000A9000000ull,0x0000000069000000ull,0x00000000E9000000ull, 0x0000000019000000ull,0x0000000099000000ull,0x0000000059000000ull,0x00000000D9000000ull,0x0000000039000000ull,0x00000000B9000000ull,0x0000000079000000ull,0x00000000F9000000ull, 0x0000000005000000ull,0x0000000085000000ull,0x0000000045000000ull,0x00000000C5000000ull,0x0000000025000000ull,0x00000000A5000000ull,0x0000000065000000ull,0x00000000E5000000ull, 0x0000000015000000ull,0x0000000095000000ull,0x0000000055000000ull,0x00000000D5000000ull,0x0000000035000000ull,0x00000000B5000000ull,0x0000000075000000ull,0x00000000F5000000ull, 0x000000000D000000ull,0x000000008D000000ull,0x000000004D000000ull,0x00000000CD000000ull,0x000000002D000000ull,0x00000000AD000000ull,0x000000006D000000ull,0x00000000ED000000ull, 0x000000001D000000ull,0x000000009D000000ull,0x000000005D000000ull,0x00000000DD000000ull,0x000000003D000000ull,0x00000000BD000000ull,0x000000007D000000ull,0x00000000FD000000ull, 0x0000000003000000ull,0x0000000083000000ull,0x0000000043000000ull,0x00000000C3000000ull,0x0000000023000000ull,0x00000000A3000000ull,0x0000000063000000ull,0x00000000E3000000ull, 0x0000000013000000ull,0x0000000093000000ull,0x0000000053000000ull,0x00000000D3000000ull,0x0000000033000000ull,0x00000000B3000000ull,0x0000000073000000ull,0x00000000F3000000ull, 0x000000000B000000ull,0x000000008B000000ull,0x000000004B000000ull,0x00000000CB000000ull,0x000000002B000000ull,0x00000000AB000000ull,0x000000006B000000ull,0x00000000EB000000ull, 0x000000001B000000ull,0x000000009B000000ull,0x000000005B000000ull,0x00000000DB000000ull,0x000000003B000000ull,0x00000000BB000000ull,0x000000007B000000ull,0x00000000FB000000ull, 0x0000000007000000ull,0x0000000087000000ull,0x0000000047000000ull,0x00000000C7000000ull,0x0000000027000000ull,0x00000000A7000000ull,0x0000000067000000ull,0x00000000E7000000ull, 0x0000000017000000ull,0x0000000097000000ull,0x0000000057000000ull,0x00000000D7000000ull,0x0000000037000000ull,0x00000000B7000000ull,0x0000000077000000ull,0x00000000F7000000ull, 0x000000000F000000ull,0x000000008F000000ull,0x000000004F000000ull,0x00000000CF000000ull,0x000000002F000000ull,0x00000000AF000000ull,0x000000006F000000ull,0x00000000EF000000ull, 0x000000001F000000ull,0x000000009F000000ull,0x000000005F000000ull,0x00000000DF000000ull,0x000000003F000000ull,0x00000000BF000000ull,0x000000007F000000ull,0x00000000FF000000ull }; static const uint64_t t5[] = { 0x0000000000000000ull,0x0000000000800000ull,0x0000000000400000ull,0x0000000000C00000ull,0x0000000000200000ull,0x0000000000A00000ull,0x0000000000600000ull,0x0000000000E00000ull, 0x0000000000100000ull,0x0000000000900000ull,0x0000000000500000ull,0x0000000000D00000ull,0x0000000000300000ull,0x0000000000B00000ull,0x0000000000700000ull,0x0000000000F00000ull, 0x0000000000080000ull,0x0000000000880000ull,0x0000000000480000ull,0x0000000000C80000ull,0x0000000000280000ull,0x0000000000A80000ull,0x0000000000680000ull,0x0000000000E80000ull, 0x0000000000180000ull,0x0000000000980000ull,0x0000000000580000ull,0x0000000000D80000ull,0x0000000000380000ull,0x0000000000B80000ull,0x0000000000780000ull,0x0000000000F80000ull, 0x0000000000040000ull,0x0000000000840000ull,0x0000000000440000ull,0x0000000000C40000ull,0x0000000000240000ull,0x0000000000A40000ull,0x0000000000640000ull,0x0000000000E40000ull, 0x0000000000140000ull,0x0000000000940000ull,0x0000000000540000ull,0x0000000000D40000ull,0x0000000000340000ull,0x0000000000B40000ull,0x0000000000740000ull,0x0000000000F40000ull, 0x00000000000C0000ull,0x00000000008C0000ull,0x00000000004C0000ull,0x0000000000CC0000ull,0x00000000002C0000ull,0x0000000000AC0000ull,0x00000000006C0000ull,0x0000000000EC0000ull, 0x00000000001C0000ull,0x00000000009C0000ull,0x00000000005C0000ull,0x0000000000DC0000ull,0x00000000003C0000ull,0x0000000000BC0000ull,0x00000000007C0000ull,0x0000000000FC0000ull, 0x0000000000020000ull,0x0000000000820000ull,0x0000000000420000ull,0x0000000000C20000ull,0x0000000000220000ull,0x0000000000A20000ull,0x0000000000620000ull,0x0000000000E20000ull, 0x0000000000120000ull,0x0000000000920000ull,0x0000000000520000ull,0x0000000000D20000ull,0x0000000000320000ull,0x0000000000B20000ull,0x0000000000720000ull,0x0000000000F20000ull, 0x00000000000A0000ull,0x00000000008A0000ull,0x00000000004A0000ull,0x0000000000CA0000ull,0x00000000002A0000ull,0x0000000000AA0000ull,0x00000000006A0000ull,0x0000000000EA0000ull, 0x00000000001A0000ull,0x00000000009A0000ull,0x00000000005A0000ull,0x0000000000DA0000ull,0x00000000003A0000ull,0x0000000000BA0000ull,0x00000000007A0000ull,0x0000000000FA0000ull, 0x0000000000060000ull,0x0000000000860000ull,0x0000000000460000ull,0x0000000000C60000ull,0x0000000000260000ull,0x0000000000A60000ull,0x0000000000660000ull,0x0000000000E60000ull, 0x0000000000160000ull,0x0000000000960000ull,0x0000000000560000ull,0x0000000000D60000ull,0x0000000000360000ull,0x0000000000B60000ull,0x0000000000760000ull,0x0000000000F60000ull, 0x00000000000E0000ull,0x00000000008E0000ull,0x00000000004E0000ull,0x0000000000CE0000ull,0x00000000002E0000ull,0x0000000000AE0000ull,0x00000000006E0000ull,0x0000000000EE0000ull, 0x00000000001E0000ull,0x00000000009E0000ull,0x00000000005E0000ull,0x0000000000DE0000ull,0x00000000003E0000ull,0x0000000000BE0000ull,0x00000000007E0000ull,0x0000000000FE0000ull, 0x0000000000010000ull,0x0000000000810000ull,0x0000000000410000ull,0x0000000000C10000ull,0x0000000000210000ull,0x0000000000A10000ull,0x0000000000610000ull,0x0000000000E10000ull, 0x0000000000110000ull,0x0000000000910000ull,0x0000000000510000ull,0x0000000000D10000ull,0x0000000000310000ull,0x0000000000B10000ull,0x0000000000710000ull,0x0000000000F10000ull, 0x0000000000090000ull,0x0000000000890000ull,0x0000000000490000ull,0x0000000000C90000ull,0x0000000000290000ull,0x0000000000A90000ull,0x0000000000690000ull,0x0000000000E90000ull, 0x0000000000190000ull,0x0000000000990000ull,0x0000000000590000ull,0x0000000000D90000ull,0x0000000000390000ull,0x0000000000B90000ull,0x0000000000790000ull,0x0000000000F90000ull, 0x0000000000050000ull,0x0000000000850000ull,0x0000000000450000ull,0x0000000000C50000ull,0x0000000000250000ull,0x0000000000A50000ull,0x0000000000650000ull,0x0000000000E50000ull, 0x0000000000150000ull,0x0000000000950000ull,0x0000000000550000ull,0x0000000000D50000ull,0x0000000000350000ull,0x0000000000B50000ull,0x0000000000750000ull,0x0000000000F50000ull, 0x00000000000D0000ull,0x00000000008D0000ull,0x00000000004D0000ull,0x0000000000CD0000ull,0x00000000002D0000ull,0x0000000000AD0000ull,0x00000000006D0000ull,0x0000000000ED0000ull, 0x00000000001D0000ull,0x00000000009D0000ull,0x00000000005D0000ull,0x0000000000DD0000ull,0x00000000003D0000ull,0x0000000000BD0000ull,0x00000000007D0000ull,0x0000000000FD0000ull, 0x0000000000030000ull,0x0000000000830000ull,0x0000000000430000ull,0x0000000000C30000ull,0x0000000000230000ull,0x0000000000A30000ull,0x0000000000630000ull,0x0000000000E30000ull, 0x0000000000130000ull,0x0000000000930000ull,0x0000000000530000ull,0x0000000000D30000ull,0x0000000000330000ull,0x0000000000B30000ull,0x0000000000730000ull,0x0000000000F30000ull, 0x00000000000B0000ull,0x00000000008B0000ull,0x00000000004B0000ull,0x0000000000CB0000ull,0x00000000002B0000ull,0x0000000000AB0000ull,0x00000000006B0000ull,0x0000000000EB0000ull, 0x00000000001B0000ull,0x00000000009B0000ull,0x00000000005B0000ull,0x0000000000DB0000ull,0x00000000003B0000ull,0x0000000000BB0000ull,0x00000000007B0000ull,0x0000000000FB0000ull, 0x0000000000070000ull,0x0000000000870000ull,0x0000000000470000ull,0x0000000000C70000ull,0x0000000000270000ull,0x0000000000A70000ull,0x0000000000670000ull,0x0000000000E70000ull, 0x0000000000170000ull,0x0000000000970000ull,0x0000000000570000ull,0x0000000000D70000ull,0x0000000000370000ull,0x0000000000B70000ull,0x0000000000770000ull,0x0000000000F70000ull, 0x00000000000F0000ull,0x00000000008F0000ull,0x00000000004F0000ull,0x0000000000CF0000ull,0x00000000002F0000ull,0x0000000000AF0000ull,0x00000000006F0000ull,0x0000000000EF0000ull, 0x00000000001F0000ull,0x00000000009F0000ull,0x00000000005F0000ull,0x0000000000DF0000ull,0x00000000003F0000ull,0x0000000000BF0000ull,0x00000000007F0000ull,0x0000000000FF0000ull }; static const uint64_t t6[] = { 0x0000000000000000ull,0x0000000000008000ull,0x0000000000004000ull,0x000000000000C000ull,0x0000000000002000ull,0x000000000000A000ull,0x0000000000006000ull,0x000000000000E000ull, 0x0000000000001000ull,0x0000000000009000ull,0x0000000000005000ull,0x000000000000D000ull,0x0000000000003000ull,0x000000000000B000ull,0x0000000000007000ull,0x000000000000F000ull, 0x0000000000000800ull,0x0000000000008800ull,0x0000000000004800ull,0x000000000000C800ull,0x0000000000002800ull,0x000000000000A800ull,0x0000000000006800ull,0x000000000000E800ull, 0x0000000000001800ull,0x0000000000009800ull,0x0000000000005800ull,0x000000000000D800ull,0x0000000000003800ull,0x000000000000B800ull,0x0000000000007800ull,0x000000000000F800ull, 0x0000000000000400ull,0x0000000000008400ull,0x0000000000004400ull,0x000000000000C400ull,0x0000000000002400ull,0x000000000000A400ull,0x0000000000006400ull,0x000000000000E400ull, 0x0000000000001400ull,0x0000000000009400ull,0x0000000000005400ull,0x000000000000D400ull,0x0000000000003400ull,0x000000000000B400ull,0x0000000000007400ull,0x000000000000F400ull, 0x0000000000000C00ull,0x0000000000008C00ull,0x0000000000004C00ull,0x000000000000CC00ull,0x0000000000002C00ull,0x000000000000AC00ull,0x0000000000006C00ull,0x000000000000EC00ull, 0x0000000000001C00ull,0x0000000000009C00ull,0x0000000000005C00ull,0x000000000000DC00ull,0x0000000000003C00ull,0x000000000000BC00ull,0x0000000000007C00ull,0x000000000000FC00ull, 0x0000000000000200ull,0x0000000000008200ull,0x0000000000004200ull,0x000000000000C200ull,0x0000000000002200ull,0x000000000000A200ull,0x0000000000006200ull,0x000000000000E200ull, 0x0000000000001200ull,0x0000000000009200ull,0x0000000000005200ull,0x000000000000D200ull,0x0000000000003200ull,0x000000000000B200ull,0x0000000000007200ull,0x000000000000F200ull, 0x0000000000000A00ull,0x0000000000008A00ull,0x0000000000004A00ull,0x000000000000CA00ull,0x0000000000002A00ull,0x000000000000AA00ull,0x0000000000006A00ull,0x000000000000EA00ull, 0x0000000000001A00ull,0x0000000000009A00ull,0x0000000000005A00ull,0x000000000000DA00ull,0x0000000000003A00ull,0x000000000000BA00ull,0x0000000000007A00ull,0x000000000000FA00ull, 0x0000000000000600ull,0x0000000000008600ull,0x0000000000004600ull,0x000000000000C600ull,0x0000000000002600ull,0x000000000000A600ull,0x0000000000006600ull,0x000000000000E600ull, 0x0000000000001600ull,0x0000000000009600ull,0x0000000000005600ull,0x000000000000D600ull,0x0000000000003600ull,0x000000000000B600ull,0x0000000000007600ull,0x000000000000F600ull, 0x0000000000000E00ull,0x0000000000008E00ull,0x0000000000004E00ull,0x000000000000CE00ull,0x0000000000002E00ull,0x000000000000AE00ull,0x0000000000006E00ull,0x000000000000EE00ull, 0x0000000000001E00ull,0x0000000000009E00ull,0x0000000000005E00ull,0x000000000000DE00ull,0x0000000000003E00ull,0x000000000000BE00ull,0x0000000000007E00ull,0x000000000000FE00ull, 0x0000000000000100ull,0x0000000000008100ull,0x0000000000004100ull,0x000000000000C100ull,0x0000000000002100ull,0x000000000000A100ull,0x0000000000006100ull,0x000000000000E100ull, 0x0000000000001100ull,0x0000000000009100ull,0x0000000000005100ull,0x000000000000D100ull,0x0000000000003100ull,0x000000000000B100ull,0x0000000000007100ull,0x000000000000F100ull, 0x0000000000000900ull,0x0000000000008900ull,0x0000000000004900ull,0x000000000000C900ull,0x0000000000002900ull,0x000000000000A900ull,0x0000000000006900ull,0x000000000000E900ull, 0x0000000000001900ull,0x0000000000009900ull,0x0000000000005900ull,0x000000000000D900ull,0x0000000000003900ull,0x000000000000B900ull,0x0000000000007900ull,0x000000000000F900ull, 0x0000000000000500ull,0x0000000000008500ull,0x0000000000004500ull,0x000000000000C500ull,0x0000000000002500ull,0x000000000000A500ull,0x0000000000006500ull,0x000000000000E500ull, 0x0000000000001500ull,0x0000000000009500ull,0x0000000000005500ull,0x000000000000D500ull,0x0000000000003500ull,0x000000000000B500ull,0x0000000000007500ull,0x000000000000F500ull, 0x0000000000000D00ull,0x0000000000008D00ull,0x0000000000004D00ull,0x000000000000CD00ull,0x0000000000002D00ull,0x000000000000AD00ull,0x0000000000006D00ull,0x000000000000ED00ull, 0x0000000000001D00ull,0x0000000000009D00ull,0x0000000000005D00ull,0x000000000000DD00ull,0x0000000000003D00ull,0x000000000000BD00ull,0x0000000000007D00ull,0x000000000000FD00ull, 0x0000000000000300ull,0x0000000000008300ull,0x0000000000004300ull,0x000000000000C300ull,0x0000000000002300ull,0x000000000000A300ull,0x0000000000006300ull,0x000000000000E300ull, 0x0000000000001300ull,0x0000000000009300ull,0x0000000000005300ull,0x000000000000D300ull,0x0000000000003300ull,0x000000000000B300ull,0x0000000000007300ull,0x000000000000F300ull, 0x0000000000000B00ull,0x0000000000008B00ull,0x0000000000004B00ull,0x000000000000CB00ull,0x0000000000002B00ull,0x000000000000AB00ull,0x0000000000006B00ull,0x000000000000EB00ull, 0x0000000000001B00ull,0x0000000000009B00ull,0x0000000000005B00ull,0x000000000000DB00ull,0x0000000000003B00ull,0x000000000000BB00ull,0x0000000000007B00ull,0x000000000000FB00ull, 0x0000000000000700ull,0x0000000000008700ull,0x0000000000004700ull,0x000000000000C700ull,0x0000000000002700ull,0x000000000000A700ull,0x0000000000006700ull,0x000000000000E700ull, 0x0000000000001700ull,0x0000000000009700ull,0x0000000000005700ull,0x000000000000D700ull,0x0000000000003700ull,0x000000000000B700ull,0x0000000000007700ull,0x000000000000F700ull, 0x0000000000000F00ull,0x0000000000008F00ull,0x0000000000004F00ull,0x000000000000CF00ull,0x0000000000002F00ull,0x000000000000AF00ull,0x0000000000006F00ull,0x000000000000EF00ull, 0x0000000000001F00ull,0x0000000000009F00ull,0x0000000000005F00ull,0x000000000000DF00ull,0x0000000000003F00ull,0x000000000000BF00ull,0x0000000000007F00ull,0x000000000000FF00ull }; static const uint64_t t7[] = { 0x0000000000000000ull,0x0000000000000080ull,0x0000000000000040ull,0x00000000000000C0ull,0x0000000000000020ull,0x00000000000000A0ull,0x0000000000000060ull,0x00000000000000E0ull, 0x0000000000000010ull,0x0000000000000090ull,0x0000000000000050ull,0x00000000000000D0ull,0x0000000000000030ull,0x00000000000000B0ull,0x0000000000000070ull,0x00000000000000F0ull, 0x0000000000000008ull,0x0000000000000088ull,0x0000000000000048ull,0x00000000000000C8ull,0x0000000000000028ull,0x00000000000000A8ull,0x0000000000000068ull,0x00000000000000E8ull, 0x0000000000000018ull,0x0000000000000098ull,0x0000000000000058ull,0x00000000000000D8ull,0x0000000000000038ull,0x00000000000000B8ull,0x0000000000000078ull,0x00000000000000F8ull, 0x0000000000000004ull,0x0000000000000084ull,0x0000000000000044ull,0x00000000000000C4ull,0x0000000000000024ull,0x00000000000000A4ull,0x0000000000000064ull,0x00000000000000E4ull, 0x0000000000000014ull,0x0000000000000094ull,0x0000000000000054ull,0x00000000000000D4ull,0x0000000000000034ull,0x00000000000000B4ull,0x0000000000000074ull,0x00000000000000F4ull, 0x000000000000000Cull,0x000000000000008Cull,0x000000000000004Cull,0x00000000000000CCull,0x000000000000002Cull,0x00000000000000ACull,0x000000000000006Cull,0x00000000000000ECull, 0x000000000000001Cull,0x000000000000009Cull,0x000000000000005Cull,0x00000000000000DCull,0x000000000000003Cull,0x00000000000000BCull,0x000000000000007Cull,0x00000000000000FCull, 0x0000000000000002ull,0x0000000000000082ull,0x0000000000000042ull,0x00000000000000C2ull,0x0000000000000022ull,0x00000000000000A2ull,0x0000000000000062ull,0x00000000000000E2ull, 0x0000000000000012ull,0x0000000000000092ull,0x0000000000000052ull,0x00000000000000D2ull,0x0000000000000032ull,0x00000000000000B2ull,0x0000000000000072ull,0x00000000000000F2ull, 0x000000000000000Aull,0x000000000000008Aull,0x000000000000004Aull,0x00000000000000CAull,0x000000000000002Aull,0x00000000000000AAull,0x000000000000006Aull,0x00000000000000EAull, 0x000000000000001Aull,0x000000000000009Aull,0x000000000000005Aull,0x00000000000000DAull,0x000000000000003Aull,0x00000000000000BAull,0x000000000000007Aull,0x00000000000000FAull, 0x0000000000000006ull,0x0000000000000086ull,0x0000000000000046ull,0x00000000000000C6ull,0x0000000000000026ull,0x00000000000000A6ull,0x0000000000000066ull,0x00000000000000E6ull, 0x0000000000000016ull,0x0000000000000096ull,0x0000000000000056ull,0x00000000000000D6ull,0x0000000000000036ull,0x00000000000000B6ull,0x0000000000000076ull,0x00000000000000F6ull, 0x000000000000000Eull,0x000000000000008Eull,0x000000000000004Eull,0x00000000000000CEull,0x000000000000002Eull,0x00000000000000AEull,0x000000000000006Eull,0x00000000000000EEull, 0x000000000000001Eull,0x000000000000009Eull,0x000000000000005Eull,0x00000000000000DEull,0x000000000000003Eull,0x00000000000000BEull,0x000000000000007Eull,0x00000000000000FEull, 0x0000000000000001ull,0x0000000000000081ull,0x0000000000000041ull,0x00000000000000C1ull,0x0000000000000021ull,0x00000000000000A1ull,0x0000000000000061ull,0x00000000000000E1ull, 0x0000000000000011ull,0x0000000000000091ull,0x0000000000000051ull,0x00000000000000D1ull,0x0000000000000031ull,0x00000000000000B1ull,0x0000000000000071ull,0x00000000000000F1ull, 0x0000000000000009ull,0x0000000000000089ull,0x0000000000000049ull,0x00000000000000C9ull,0x0000000000000029ull,0x00000000000000A9ull,0x0000000000000069ull,0x00000000000000E9ull, 0x0000000000000019ull,0x0000000000000099ull,0x0000000000000059ull,0x00000000000000D9ull,0x0000000000000039ull,0x00000000000000B9ull,0x0000000000000079ull,0x00000000000000F9ull, 0x0000000000000005ull,0x0000000000000085ull,0x0000000000000045ull,0x00000000000000C5ull,0x0000000000000025ull,0x00000000000000A5ull,0x0000000000000065ull,0x00000000000000E5ull, 0x0000000000000015ull,0x0000000000000095ull,0x0000000000000055ull,0x00000000000000D5ull,0x0000000000000035ull,0x00000000000000B5ull,0x0000000000000075ull,0x00000000000000F5ull, 0x000000000000000Dull,0x000000000000008Dull,0x000000000000004Dull,0x00000000000000CDull,0x000000000000002Dull,0x00000000000000ADull,0x000000000000006Dull,0x00000000000000EDull, 0x000000000000001Dull,0x000000000000009Dull,0x000000000000005Dull,0x00000000000000DDull,0x000000000000003Dull,0x00000000000000BDull,0x000000000000007Dull,0x00000000000000FDull, 0x0000000000000003ull,0x0000000000000083ull,0x0000000000000043ull,0x00000000000000C3ull,0x0000000000000023ull,0x00000000000000A3ull,0x0000000000000063ull,0x00000000000000E3ull, 0x0000000000000013ull,0x0000000000000093ull,0x0000000000000053ull,0x00000000000000D3ull,0x0000000000000033ull,0x00000000000000B3ull,0x0000000000000073ull,0x00000000000000F3ull, 0x000000000000000Bull,0x000000000000008Bull,0x000000000000004Bull,0x00000000000000CBull,0x000000000000002Bull,0x00000000000000ABull,0x000000000000006Bull,0x00000000000000EBull, 0x000000000000001Bull,0x000000000000009Bull,0x000000000000005Bull,0x00000000000000DBull,0x000000000000003Bull,0x00000000000000BBull,0x000000000000007Bull,0x00000000000000FBull, 0x0000000000000007ull,0x0000000000000087ull,0x0000000000000047ull,0x00000000000000C7ull,0x0000000000000027ull,0x00000000000000A7ull,0x0000000000000067ull,0x00000000000000E7ull, 0x0000000000000017ull,0x0000000000000097ull,0x0000000000000057ull,0x00000000000000D7ull,0x0000000000000037ull,0x00000000000000B7ull,0x0000000000000077ull,0x00000000000000F7ull, 0x000000000000000Full,0x000000000000008Full,0x000000000000004Full,0x00000000000000CFull,0x000000000000002Full,0x00000000000000AFull,0x000000000000006Full,0x00000000000000EFull, 0x000000000000001Full,0x000000000000009Full,0x000000000000005Full,0x00000000000000DFull,0x000000000000003Full,0x00000000000000BFull,0x000000000000007Full,0x00000000000000FFull }; union Encoder { uint8_t b[8]; uint64_t data; }; uint64_t encode(uint64_t data) { union Encoder e; e.data = data; return t0[e.b[0]] | t1[e.b[1]] | t2[e.b[2]] | t3[e.b[3]] | t4[e.b[4]] | t5[e.b[5]] | t6[e.b[6]] | t7[e.b[7]]; } /* Test */ #include <stdio.h> void t(uint64_t v) { printf("%016llX -> %016llX\n", v, encode(v)); } int main() { uint64_t v=1; int i; for(i=0;i<64; i++, v<<=1) { t(v); } t(0x0123456789ABCDEFull); } После строки /* Test */ специально для вас написал тестовый кусок. Вот выхлоп: 0000000000000001 -> 8000000000000000 0000000000000002 -> 4000000000000000 0000000000000004 -> 2000000000000000 0000000000000008 -> 1000000000000000 0000000000000010 -> 0800000000000000 0000000000000020 -> 0400000000000000 0000000000000040 -> 0200000000000000 0000000000000080 -> 0100000000000000 0000000000000100 -> 0080000000000000 0000000000000200 -> 0040000000000000 0000000000000400 -> 0020000000000000 0000000000000800 -> 0010000000000000 0000000000001000 -> 0008000000000000 0000000000002000 -> 0004000000000000 0000000000004000 -> 0002000000000000 0000000000008000 -> 0001000000000000 0000000000010000 -> 0000800000000000 0000000000020000 -> 0000400000000000 0000000000040000 -> 0000200000000000 0000000000080000 -> 0000100000000000 0000000000100000 -> 0000080000000000 0000000000200000 -> 0000040000000000 0000000000400000 -> 0000020000000000 0000000000800000 -> 0000010000000000 0000000001000000 -> 0000008000000000 0000000002000000 -> 0000004000000000 0000000004000000 -> 0000002000000000 0000000008000000 -> 0000001000000000 0000000010000000 -> 0000000800000000 0000000020000000 -> 0000000400000000 0000000040000000 -> 0000000200000000 0000000080000000 -> 0000000100000000 0000000100000000 -> 0000000080000000 0000000200000000 -> 0000000040000000 0000000400000000 -> 0000000020000000 0000000800000000 -> 0000000010000000 0000001000000000 -> 0000000008000000 0000002000000000 -> 0000000004000000 0000004000000000 -> 0000000002000000 0000008000000000 -> 0000000001000000 0000010000000000 -> 0000000000800000 0000020000000000 -> 0000000000400000 0000040000000000 -> 0000000000200000 0000080000000000 -> 0000000000100000 0000100000000000 -> 0000000000080000 0000200000000000 -> 0000000000040000 0000400000000000 -> 0000000000020000 0000800000000000 -> 0000000000010000 0001000000000000 -> 0000000000008000 0002000000000000 -> 0000000000004000 0004000000000000 -> 0000000000002000 0008000000000000 -> 0000000000001000 0010000000000000 -> 0000000000000800 0020000000000000 -> 0000000000000400 0040000000000000 -> 0000000000000200 0080000000000000 -> 0000000000000100 0100000000000000 -> 0000000000000080 0200000000000000 -> 0000000000000040 0400000000000000 -> 0000000000000020 0800000000000000 -> 0000000000000010 1000000000000000 -> 0000000000000008 2000000000000000 -> 0000000000000004 4000000000000000 -> 0000000000000002 8000000000000000 -> 0000000000000001 0123456789ABCDEF -> F7B3D591E6A2C480 32 minutes ago, jcxz said: PS: Дальнейшую дискуссию с вами прекращаю, так как вижу, что бессмысленно. Т.е. слились. Как и следовало ожидать PS. В примере закодирован своп битов (0->63, 1->62 и т.д.) Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
jcxz 234 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 1 час назад, xvr сказал: Т.е. вы не в состоянии завернуть строку кода в функцию и проверить? (Почему то я не удивлён) Я всего лишь добиваюсь, чтобы вы сами это сделали. Чтобы не говорили потом, что это "я неправильно вас понял" или "вы совсем не это имели в виду". Чтобы сами убедились в бесперспективности своего способа. Цитата Держите: union Encoder { uint8_t b[8]; uint64_t data; }; uint64_t encode(uint64_t data) { union Encoder e; e.data = data; return t0[e.b[0]] | t1[e.b[1]] | t2[e.b[2]] | t3[e.b[3]] | t4[e.b[4]] | t5[e.b[5]] | t6[e.b[6]] | t7[e.b[7]]; } И разве здесь не очевидно, что это будет работать КРАЙНЕ медленно? Это даже если потратить так неэффективно 16КБ внутренней быстрой ОЗУ? Располагаем массивы во внутреннем быстром ОЗУ, компилим при максимальной оптимизации, выполняем (при запрещённых прерываниях) на CM4, получаем время выполнения = ~99 тактов! Это при том, что тот код, который я приводил, на ту же самую операцию тратит 85 тактов. На том же МК. Без всяких гигантских таблиц А в реальности таблицы будут во флешь, а значит время выполнения может ещё многократно увеличиться. Так в чём же смысл вашего табличного метода? Цитата Т.е. слились. Как и следовало ожидать Я не понимаю к чему все эти "слились", "корона не жмёт" о которой вы всё время талдычите? Когда обсуждается чисто технический вопрос. У вас какие-то проблемы в личном плане? Сливались до сих пор только вы. Когда отказывались предоставить рабочий код, чтобы наглядно показать вам всю бесперспективность вашего способа. И как только его предоставили - всё стало совершенно очевидно. Теперь любой может проверить сам и убедиться. PS: Ещё вопросы есть? или теперь даже до вас дошло, что ваш метод бесполезный? Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
jcxz 234 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 1 час назад, xvr сказал: PS. В примере закодирован своп битов (0->63, 1->62 и т.д.) И да - причём тут "своп битов" если задача состояла совсем в другом? Ваш результат - неверный. Решение - неверное. Правильное решение задачи будет? Или продолжите в том же духе пустой звон? PS: А своп битов делается 2-мя командами RBIT. Это всего 2 такта(!) (не считая загрузки/выгрузки). И не требует воротить тонну быдлокода. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
adnega 11 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 1 час назад, jcxz сказал: Как уже писал: bit-band в этой задаче - самый медленный способ. Ок. Я тут прикинул: void func_bb(void *p) { 8000600: e92d 41f0 stmdb sp!, {r4, r5, r6, r7, r8, lr} volatile int *dst, *src; for(int n = 0; n < 8; n++) 8000604: 2400 movs r4, #0 { dst = &RAM_BIT_ADDR(&stat_video_digit[0], n_pos[n]); 8000606: 4d14 ldr r5, [pc, #80] ; 8000658 stat_video_digit 8000608: 4a14 ldr r2, [pc, #80] ; 800065c digit_video 800060a: 4f15 ldr r7, [pc, #84] ; 8000660 n_pos for(int j = 0; j < VALUE_SIZE; j++) { src = &RAM_BIT_ADDR(&digit_video[n * VALUE_SIZE + j], 7); 800060c: f8df e054 ldr.w lr, [pc, #84] ; 8000664 bb dst = &RAM_BIT_ADDR(&stat_video_digit[0], n_pos[n]); 8000610: 016d lsls r5, r5, #5 8000612: 0152 lsls r2, r2, #5 8000614: 4616 mov r6, r2 8000616: f817 3b01 ldrb.w r3, [r7], #1 800061a: ea45 0383 orr.w r3, r5, r3, lsl #2 800061e: f043 5308 orr.w r3, r3, #570425344 ; 0x22000000 for(int j = 0; j < VALUE_SIZE; j++) 8000622: f503 7180 add.w r1, r3, #256 ; 0x100 8000626: f503 63a0 add.w r3, r3, #1280 ; 0x500 800062a: f5a1 7080 sub.w r0, r1, #256 ; 0x100 src = &RAM_BIT_ADDR(&digit_video[n * VALUE_SIZE + j], 7); 800062e: ea46 0c0e orr.w ip, r6, lr for(int i = 0; i < 8; i++) { *dst = *src; 8000632: f85c 8904 ldr.w r8, [ip], #-4 8000636: f840 8b20 str.w r8, [r0], #32 for(int i = 0; i < 8; i++) 800063a: 4288 cmp r0, r1 800063c: d1f9 bne.n 8000632 ; 8 times * (ldr + str + cmp + bne) = 32 = LOOP1 800063e: f500 7180 add.w r1, r0, #256 ; 0x100 for(int j = 0; j < VALUE_SIZE; j++) 8000642: 428b cmp r3, r1 8000644: f106 0620 add.w r6, r6, #32 8000648: d1ef bne.n 800062a ; 4 times * (LOOP1 + sub + orr + add + cmp + add + bne) = 152 = LOOP2 for(int n = 0; n < 8; n++) 800064a: 3401 adds r4, #1 800064c: 2c08 cmp r4, #8 800064e: f102 0280 add.w r2, r2, #128 ; 0x80 8000652: d1df bne.n 8000614 ; 8 times * (LOOP2 + mov + ldrb + orr * 2 + add * 2 + cmp + bne) = 1280 src -= 1; dst += 8; } } } } 8000654: e8bd 81f0 ldmia.w sp!, {r4, r5, r6, r7, r8, pc} ; total = LOOP3 + 9 = 1290 8000658: 0000022c .word 0x0000022c ; stat_video_digit 800065c: 2000024c .word 0x2000024c ; digit_video 8000660: 08003ead .word 0x08003ead ; n_pos 8000664: 2200001c .word 0x2200001c ; bb Получается 1290 инструкций. Пусть в среднем 2 такта на инструкцию и увеличим число инструкций до 1800. При развертке 100 Гц получается 360к тактов, что при 72 МГц тактовой частоты дает нагрузку 0.5%. Ядро Cortex-M3. Добавьте в ваш код таблицу n_pos. Она константная, поэтому будем считать, что ничего не изменяется в плане быстродействия, но в плане сопровождения просто хочется видеть насколько это муторно. У вас код 85 тактов. Умножаем на 4 (VALUE_SIZE) получается 340, т.е. примерно в 8 раз быстрее. Кста, размер кода у меня порядка 100 байт, у вас - в три * 4 раза больше. Т.е. по размеру я выигрываю в 12 раз ;) Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
jcxz 234 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 3 минуты назад, adnega сказал: У вас код 85 тактов. Умножаем на 4 (VALUE_SIZE) получается 340, т.е. примерно в 8 раз быстрее. Мой тот код - он для Cortex-M4 и не будет работать на CM3. Писал там же об этом. На CM3 придётся выполнить ~64 пары UBFX/BFI. Но всё равно это должно быть многократно быстрее bit-band. Не в 8 раз, а в 4-5 наверное. 3 минуты назад, adnega сказал: Кста, размер кода у меня порядка 100 байт, у вас - в три * 4 раза больше. Т.е. по размеру я выигрываю в 12 раз ;) Ну понятно: при оптимизации часто так - чем-то нужно жертвовать. Или скоростью или размером. Если бы речь шла об оптимизации размера, я бы сделал всё равно не на bit-band, а в регистрах CPU. И ещё неизвестно что имело бы меньший размер. Но даже в таком виде - быстрее было бы в регистрах. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
adnega 11 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 3 часа назад, jcxz сказал: Не в 8 раз, а в 4-5 наверное. На самом деле исходные 8 байт идут не подряд, а с некоторым шагом (например, 4 байта). Походу, ваш алгоритм от этого становится менее быстрым. Кста, в некоторых случаях шаг может быть значительно больше, и даже не степень двойки (например, 32 + 4 = 36). Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
jcxz 234 25 апреля, 2022 Опубликовано 25 апреля, 2022 · Жалоба 1 час назад, adnega сказал: На самом деле исходные 8 байт идут не подряд, а с некоторым шагом (например, 4 байта). Походу, ваш алгоритм от этого становится менее быстрым. Тогда чтение будет не 3 такта, а чуть больше. В худшем случае добавятся 16-3=13 тактов. Непринципиально. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться