static unsigned short NEAR sqrtab[] = { 0, 4096, 5792, 7094, 8192, 9158, 10033, 10836, 11585, 12288, 12952, 13584, 14188, 14768, 15325, 15863, 16384, 16888, 17377, 17854, 18317, 18770, 19211, 19643, 20066, 20480, 20885, 21283, 21673, 22057, 22434, 22805, 23170, 23529, 23883, 24232, 24576, 24914, 25249, 25579, 25905, 26227, 26545, 26859, 27169, 27476, 27780, 28080, 28377, 28672, 28963, 29251, 29536, 29819, 30099, 30376, 30651, 30924, 31194, 31461, 31727, 31990, 32251, 32510, 32768, 33023, 33276, 33527, 33776, 34023, 34269, 34513, 34755, 34996, 35235, 35472, 35708, 35942, 36174, 36406, 36635, 36864, 37090, 37316, 37540, 37763, 37984, 38204, 38423, 38641, 38858, 39073, 39287, 39500, 39712, 39922, 40132, 40340, 40548, 40754, 40960, 41164, 41367, 41569, 41771, 41971, 42170, 42369, 42566, 42763, 42959, 43154, 43347, 43541, 43733, 43924, 44115, 44305, 44493, 44682, 44869, 45056, 45241, 45426, 45611, 45794, 45977, 46159, 46340, 46521, 46701, 46880, 47059, 47237, 47414, 47591, 47767, 47942, 48117, 48291, 48464, 48637, 48809, 48981, 49152, 49322, 49492, 49661, 49829, 49998, 50165, 50332, 50498, 50664, 50830, 50994, 51159, 51322, 51485, 51648, 51810, 51972, 52133, 52294, 52454, 52614, 52773, 52931, 53090, 53248, 53405, 53562, 53718, 53874, 54029, 54184, 54339, 54493, 54647, 54800, 54953, 55106, 55258, 55409, 55560, 55711, 55861, 56011, 56161, 56310, 56459, 56607, 56755, 56903, 57050, 57197, 57344, 57490, 57635, 57781, 57926, 58070, 58215, 58359, 58502, 58645, 58788, 58931, 59073, 59215, 59356, 59497, 59638, 59779, 59919, 60059, 60198, 60337, 60476, 60615, 60753, 60891, 61029, 61166, 61303, 61440, 61576, 61712, 61848, 61983, 62118, 62253, 62388, 62522, 62656, 62790, 62923, 63057, 63190, 63322, 63454, 63587, 63718, 63850, 63981, 64112, 64243, 64373, 64503, 64633, 64763, 64892, 65021, 65150, 65279, 65407, 65535 }; extern unsigned short FAR my_sqrt (unsigned long x) { register unsigned int r, t; register int e; if (x >= 0x00010000UL) if (x >= 0x01000000UL) if (x >= 0xfffe0001UL) return (0xffffU); else r = sqrtab[(x>>24)+1]; else r = sqrtab[(x>>16)+1] >> 4; else if ((unsigned int)x >= 0x0100U) r = sqrtab[((unsigned int)x>>8)+1] >> 8; else return (sqrtab[x] >> 12); do { t = (unsigned int)(x / r); e = (int)(r - t) / 2; r -= e; } while (e); return ((unsigned short)t); }