ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
28 марта
536517 Топик полностью
бомж (04.08.2014 19:02, просмотров: 72) ответил zeleny на быстрый 16-битный sqrt никто не встречал ? таблично реально сделать ? про побитный сдвиг/проверку знаю, нужно еще быстрее.
Вот такой ещё, вариация на тему Редчука  typedef unsigned char uint8; typedef unsigned short int uint16; typedef unsigned long int uint32; uint32 // OR uint16 OR uint8 isqrt32 (uint32 n) // OR isqrt16 ( uint16 n ) OR isqrt8 ( uint8 n ) - respectively [ OR overloaded as isqrt (uint?? n) in C++ ] { register uint32 // OR register uint16 OR register uint8 - respectively root, remainder, place; root = 0; remainder = n; place = 0x40000000; // OR place = 0x4000; OR place = 0x40; - respectively while (place > remainder) place = place >> 2; while (place) { if (remainder >= root + place) { remainder = remainder - root - place; root = root + (place << 1); } root = root >> 1; place = place >> 2; } return root; }
memento mori