{"id":274210,"date":"2016-02-13T14:49:02","date_gmt":"2016-02-13T11:49:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=274210"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=274210","title":{"rendered":"\u041e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0435 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432"},"content":{"rendered":"<p>       \u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0425\u0430\u0431\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043e\u0442 8 \u0434\u043e 64 \u0431\u0438\u0442\u043e\u0432. \u042d\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0443 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u00ab\u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0433\u0438\u0438\u00bb \u0438\u043b\u0438 \u00ab\u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0438\u00bb, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u043e\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043a\u0440\u0430\u0441\u043e\u0442\u043e\u0439 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u044d\u0442\u043e\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0438 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0438 \u0432\u044b \u0434\u0430\u0436\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0451\u043c\u0430\u043c\u0438, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c, \u044f \u0441\u0440\u0430\u0437\u0443 \u0445\u043e\u0447\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0432 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0441\u0435\u0431\u0435 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u00ab\u0438\u00bb, \u00ab\u0438\u043b\u0438\u00bb, \u0441\u0434\u0432\u0438\u0433), \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043b\u0430\u0434\u0435\u043b \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432 \u043d\u0451\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c\u0438, \u043d\u043e \u0441\u0430\u043c\u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u043e\u043d\u0438 \u043b\u0438\u0448\u044c \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442, \u043d\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u0441\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0451\u043c\u044b \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0421\u0438 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445: 32 \u0438 64 \u0431\u0438\u0442\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043b\u0438 \u044f\u0437\u044b\u043a \u0421\u0438. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Core 2 Duo E8400  @3GHz \u043d\u0430 64-\u0445 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 Windows 7. \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b <a href=\"http:\/\/code.google.com\/p\/runexe\">runexe<\/a>. \u0412\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b <a href=\"https:\/\/yadi.sk\/d\/XiHe6MNtomAeh\">\u0432 \u0430\u0440\u0445\u0438\u0432\u0435<\/a> \u043d\u0430 \u042f\u043d\u0434\u0435\u043a\u0441 \u0434\u0438\u0441\u043a\u0435, \u0438\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 Visual C++, Intel C++, GCC \u0438 CLang, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0443 \u0432\u0430\u0441 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0443 \u0441\u0435\u0431\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Linux, \u0434\u0443\u043c\u0430\u044e, \u043b\u0443\u0447\u0448\u0435 \u043c\u0435\u043d\u044f \u0437\u043d\u0430\u044e\u0442, \u043a\u0430\u043a \u0438\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0443 \u0441\u0435\u0431\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043d\u0435 \u0434\u0430\u044e.<\/p>\n<p>  \u0421\u0440\u0435\u0434\u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0438\u0435, \u043a\u043e\u043c\u0443 \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e. \u042f \u0437\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u043e\u0435 \u0432\u0438\u0434\u0435\u043e (58 \u043c\u0438\u043d\u0443\u0442), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043e \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0436\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0442\u0438\u043b\u0435, \u0431\u043e\u043b\u0435\u0435 \u0441\u0443\u0445\u043e \u0438 \u0441\u0442\u0440\u043e\u0433\u043e, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0436\u0438\u0432\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0437\u0443\u0447\u0430\u0439\u0442\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0430\u043a, \u043a\u0430\u043a \u043a\u043e\u043c\u0443 \u0443\u0434\u043e\u0431\u043d\u0435\u0435. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0438\u0434\u0435\u043e<\/b><\/p>\n<div class=\"spoiler_text\"><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/eSZ9wzJEnhU?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe>  <\/div>\n<\/div>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u043c\u044b\u0435 \u0442\u0435\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0430\u043b\u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0451\u043c\u043e\u0432, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e \u0432\u0441\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c. \u0412\u043e \u0432\u0441\u0435\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430 \u043e\u0442 8 \u0434\u043e 64 \u0431\u0438\u0442. <\/p>\n<pre><code class=\"cpp\">typedef unsigned char      u8; typedef unsigned short int u16; typedef unsigned int       u32; typedef unsigned long long u64; <\/code><\/pre>\n<h4>\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h4>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0431\u0438\u0442\u043e\u0432\u0430\u044f \u0430\u043b\u0445\u0438\u043c\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u043b\u0438\u0441\u0442\u0430\u0442\u044c \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438, \u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0447\u0435\u043c\u0443? \u041f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0451\u043c\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u0437\u0430\u0434\u0430\u0447\u0443. \u0422\u0430\u043a\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u0451\u043c\u043e\u043c \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0443 \u0431\u0438\u0442\u043e\u0432: \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u043e\u0442\u043a\u0443\u0441\u044b\u0432\u0430\u0435\u043c\u00bb \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043e\u0434\u0438\u043d \u0431\u0438\u0442 \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0438\u0445, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0447\u0438\u0441\u043b\u043e \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0432\u043d\u044b\u043c \u043d\u0443\u043b\u044e.<\/p>\n<pre><code class=\"cpp\">u8 CountOnes0 (u8 n) {   u8 res = 0;   while (n) {     res += n&1;     n &gt;&gt;= 1;   }   return res; } <\/code><\/pre>\n<p>  \u042f \u043d\u0435 \u0432\u0438\u0436\u0443 \u0441\u043c\u044b\u0441\u043b\u0430 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435. \u041d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0451\u043d\u043d\u044b\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u044f\u0441\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0447\u0438\u0441\u043b\u0430 n \u0440\u0430\u0432\u0435\u043d 1, \u0442\u043e \u0446\u0438\u043a\u043b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u0432\u0441\u0435\u043c \u0431\u0438\u0442\u0430\u043c \u0447\u0438\u0441\u043b\u0430, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u043e\u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0434\u043e \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e.<\/p>\n<p>  \u041c\u0435\u043d\u044f\u044f \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 u8 \u043d\u0430 u16, u32 \u0438 u64 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c 4 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u0435 \u0438\u0437 2<sup>32<\/sup> \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u0445\u0430\u043e\u0442\u0438\u0447\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f u8 \u0443 \u043d\u0430\u0441 256 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c 2<sup>32<\/sup> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0438 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0440\u0438\u0447\u0451\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u0437\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043e\u0434\u0443 \u0443\u0447\u0435\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430).<\/p>\n<p>  \u0412\u0440\u0435\u043c\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0438\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430\u0441\u044c \u0442\u0440\u0438\u0436\u0434\u044b \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0435\u0434\u0432\u0430 \u043b\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 0,1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (32-\u0445 \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u043b\u0438 64-\u0445 \u0431\u0438\u0442\u043e\u0432\u044b\u0439), \u0434\u0430\u043b\u0435\u0435 4 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 4 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>38,18<\/td>\n<td>72,00<\/td>\n<td>130,49<\/td>\n<td>384,76<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>37,72<\/td>\n<td>71,51<\/td>\n<td>131,47<\/td>\n<td>227,46<\/td>\n<\/tr>\n<\/table>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043f\u043e\u043b\u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0447\u0438\u0441\u043b\u0430 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 64 \u0431\u0438\u0442\u0430, \u0430 \u043f\u043e\u0434\u0441\u0447\u0451\u0442 \u0438\u0434\u0451\u0442 \u0440\u0435\u0436\u0438\u043c\u0435 x86. \u042f\u0441\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u043a\u0440\u0430\u0442\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438 \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0438 \u0434\u0430\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043e\u043d \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0432\u0442\u0440\u043e\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435). \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u0430 \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. <\/p>\n<h4>\u0422\u0440\u044e\u043a \u0441 \u00ab\u043e\u0442\u043a\u0443\u0441\u044b\u0432\u0430\u043d\u0438\u0435\u043c\u00bb \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432<\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u0430\u043b\u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u0451\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u0434\u0435\u0435 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u0431\u0438\u0442\u0430. \u0418\u043c\u0435\u044f \u0447\u0438\u0441\u043b\u043e n, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u043d\u0435\u0441\u0442\u0438 \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0435 n=n&#038;(n-1), \u0437\u0430\u0431\u0438\u0440\u0430\u044f \u0443 \u0447\u0438\u0441\u043b\u0430 n \u0435\u0433\u043e \u043c\u043b\u0430\u0434\u0448\u0443\u044e \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0443. \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043d\u0438\u0436\u0435 \u0434\u043b\u044f n=232 \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043b\u044e\u0434\u0435\u0439, \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0443\u0437\u043d\u0430\u0432\u0448\u0438\u0445 \u043e\u0431 \u044d\u0442\u043e\u043c \u0442\u0440\u044e\u043a\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3c5\/6bd\/168\/3c56bd1688634b279c4b9916b05b0576.png\" width=\"50%\" \/><\/div>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f.   <\/p>\n<pre><code class=\"cpp\">u8 CountOnes1 (u8 n) {   u8 res = 0;   while (n) {     res ++;     n &= n-1;  \/\/ \u0417\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0443\u044e \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0443.   }   return res; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0446\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0435\u0434\u0438\u043d\u0438\u0446 \u0432 \u0447\u0438\u0441\u043b\u0435 n. \u042d\u0442\u043e \u043d\u0435 \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442 \u0445\u0443\u0434\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0432 \u0447\u0438\u0441\u043b\u0435 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0435, \u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0421\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442 \u0441\u0442\u0440\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c, \u0430 \u0434\u043b\u044f 8 \u0431\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u0436\u0435 \u0445\u0443\u0436\u0435. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0441\u0432\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0446\u0435, \u0430 \u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>44,73<\/td>\n<td>55,88<\/td>\n<td>72,02<\/td>\n<td>300,78<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>40,96<\/td>\n<td>69,16<\/td>\n<td>79,13<\/td>\n<td>126,72<\/td>\n<\/tr>\n<\/table>\n<h4>\u041f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442<\/h4>\n<p>  \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u0442\u043e\u0440\u043e\u043f\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u00ab\u0436\u0451\u0441\u0442\u043a\u0438\u043c\u00bb \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u044f\u043c, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0441\u043f\u0430\u0441\u0442\u0438 \u0434\u0430\u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0435\u043e\u043f\u044b\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0430. \u0414\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043a \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0417\u0430\u0432\u0435\u0434\u0451\u043c \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 256 \u0438 65536 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 1-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0438 2-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.  <\/p>\n<pre><code class=\"cpp\">  u8 BitsSetTableFF[256];     \/\/ \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430   u8 BitsSetTableFFFF[65536]; \/\/ \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0431\u0430\u0439\u0442 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f 1 \u0431\u0430\u0439\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a  <\/p>\n<pre><code class=\"cpp\">  u8 CountOnes2_FF (u8 n) {     return BitsSetTableFF[n];   } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0431\u0438\u0442 \u0432 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0447\u0438\u0441\u043b\u0430\u0445, \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u0431\u0430\u0439\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f u32 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">  u8 CountOnes2_FF (u32 n) {     u8 *p = (u8*)&n;     n = BitsSetTableFF[p[0]]       + BitsSetTableFF[p[1]]       + BitsSetTableFF[p[2]]       + BitsSetTableFF[p[3]];     return n;   } <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0442\u0430\u043a\u043e\u0439, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0434\u043b\u044f 2-\u0445 \u0431\u0430\u0439\u0442:  <\/p>\n<pre><code class=\"cpp\">  u8 CountOnes2_FFFF (u32 n) {     u16 *p = (u16*)&n;     n = BitsSetTableFFFF[p[0]]       + BitsSetTableFFFF[p[1]];     return n;   } <\/code><\/pre>\n<p>  \u041d\u0443 \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 n (\u043a\u0440\u043e\u043c\u0435 8 \u0431\u0438\u0442) \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c. \u0414\u0443\u043c\u0430\u044e, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0432\u0437\u044f\u0442\u044c \u0438 \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 BitsSetTableFFFFFFFF, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0433\u0434\u0435 \u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043d\u044b\u043c.<\/p>\n<p>  \u0411\u044b\u0441\u0442\u0440\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442? \u0412\u0441\u0451 \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0438\u0436\u0435. \u041f\u0435\u0440\u0432\u0430\u044f \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>0,01<\/td>\n<td>1,83<\/td>\n<td>21,07<\/td>\n<td>36,25<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>0,01<\/td>\n<td>1,44<\/td>\n<td>24,79<\/td>\n<td>26,84<\/td>\n<\/tr>\n<\/table>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 x64 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442 \u0434\u043b\u044f u64 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0445\u043e\u0442\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td> &#8212;<\/td>\n<td>0,05<\/td>\n<td> 7,95<\/td>\n<td>13,01<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td> &#8212;<\/td>\n<td>0,07<\/td>\n<td> 8,49<\/td>\n<td>13,01<\/td>\n<\/tr>\n<\/table>\n<p>  \u0412\u0430\u0436\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0433\u043e\u0434\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439: <b>(1)<\/b> \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043b\u0438\u0448\u043d\u044f\u044f \u043f\u0430\u043c\u044f\u0442\u044c, <b>(2)<\/b> \u0432\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442 \u0447\u0438\u0441\u043b\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437, \u0447\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0430\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u00ab\u043e\u0442\u044b\u0433\u0440\u0430\u0442\u044c\u00bb \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0438\u0437 \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0432 \u0432\u0438\u0434\u0443 \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u0437 \u043a\u044d\u0448\u0430 \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430. \u041a\u043e\u0441\u044f\u043a \u044d\u0442\u043e \u0432\u044b \u0432\u0440\u044f\u0434 \u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0431\u044b\u0441\u0442\u0440\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0447\u0443\u0434\u043e\u0432\u0438\u0449\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0434\u0432\u0430 \u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c.<\/p>\n<h4>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0436\u0435 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0431\u043e\u043b\u0435\u0435 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u0435\u043b\u044c\u044f \u0441 \u043d\u0430\u0448\u0435\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e\u043b\u043a\u0438. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0435\u0449\u0438. \u041d\u0430\u0447\u043d\u0451\u043c \u0442\u0432\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0435 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043e\u0442 \u00aba\u00bb \u0434\u043e \u00abh\u00bb. \u041d\u0430\u0448\u0435 \u0447\u0438\u0441\u043b\u043e n \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9c6\/877\/dff\/9c6877dff8a54f659c3595eb89dc964c.png\" width=\"40%\" \/><\/div>\n<p>  \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 n&#8217; = n\u22c50x010101 (\u0442\u0430\u043a, \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u00ab0x\u00bb, \u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430) \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0438 \u0447\u0442\u043e \u0438\u043d\u043e\u0435 \u043a\u0430\u043a \u00ab\u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0432 \u0442\u0440\u0451\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u0445:  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/af9\/eb0\/df3\/af9eb0df31244ad8b44c58d4f88551ff.png\" width=\"100%\" \/><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u043e\u0431\u044c\u0451\u043c \u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e \u043d\u0430\u0448\u0438 24 \u0431\u0438\u0442\u0430 \u043d\u0430 8 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e 3 \u0431\u0438\u0442\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c (\u0441\u043c. \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0438). \u0417\u0430\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u00ab\u0438\u00bb \u0441 \u043c\u0430\u0441\u043a\u043e\u0439 0x249249 (\u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0438) \u043e\u0431\u043d\u0443\u043b\u0438\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u0434\u0432\u0430 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/92e\/de7\/ce8\/92ede7ce88db48afabc35304c6048867.png\" width=\"100%\" \/><\/div>\n<p>  \u0422\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u044f\u0441\u043d\u044f\u0435\u0442 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u0430\u0441\u043a\u0438. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0434\u043e\u0431\u0438\u0432\u0430\u043b\u0438\u0441\u044c: \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u0441\u0432\u043e\u0451\u043c \u0442\u0440\u0451\u0445\u0431\u0438\u0442\u043e\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0435, \u043d\u043e \u0432 \u0438\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043d\u0430\u043c \u0438 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d).<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u044d\u0442\u0438 8 \u0431\u043b\u043e\u043a\u043e\u0432 \u2013 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0443\u043c\u043c\u0443 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u0442! <\/p>\n<p>  \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 A \u043d\u0430 2<sup>k<\/sup>-1 \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u0430\u0451\u0442 \u0441\u0443\u043c\u043c\u0443 k-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0447\u0438\u0441\u043b\u0430 A, \u0442\u043e\u0436\u0435 \u0432\u0437\u044f\u0442\u0443\u044e \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 2<sup>k<\/sup>-1.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0443\u0444<\/b><\/p>\n<div class=\"spoiler_text\">\u0420\u0430\u0437\u043e\u0431\u044c\u0451\u043c \u0447\u0438\u0441\u043b\u043e A (\u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438) \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043f\u043e k \u0431\u0438\u0442 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c (\u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439, \u0441\u0442\u0430\u0440\u0448\u0438\u0439, \u0431\u043b\u043e\u043a \u043d\u0443\u043b\u044f\u043c\u0438). \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0447\u0435\u0440\u0435\u0437 A<sub>i<\/sub> i-\u0439 \u0431\u043b\u043e\u043a. \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 A \u0447\u0435\u0440\u0435\u0437 \u0441\u0443\u043c\u043c\u0443 \u044d\u0442\u0438\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u043f\u043e\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438:<br \/>  A= A<sub>0<\/sub>\u22c52<sup>0\u22c5k<\/sup>+ A<sub>1<\/sub>\u22c52<sup>1\u22c5k<\/sup>+\u2026+ A<sub>N-1<\/sub>\u22c52<sup>(N-1)\u22c5k<\/sup>,<br \/>  \u0433\u0434\u0435 N \u2013 \u0447\u0438\u0441\u043b\u043e \u0431\u043b\u043e\u043a\u043e\u0432.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c A mod (2<sup>k<\/sup>-1).<br \/>  A mod (2<sup>k<\/sup>-1)= (A<sub>0<\/sub>\u22c52<sup>0\u22c5k<\/sup>+ A<sub>1<\/sub>\u22c52<sup>1\u22c5k<\/sup>+\u2026+ A<sub>N-1<\/sub>\u22c52<sup>(N-1)\u22c5k<\/sup>) mod (2<sup>k<\/sup>-1) = (A<sub>0<\/sub>+ A<sub>1<\/sub>+\u2026+ A<sub>N-1<\/sub>) mod (2<sup>k<\/sup>-1).<br \/>  \u0412\u0441\u0451 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e 2<sup>i\u22c5k<\/sup> = 1 (mod (2<sup>k<\/sup>-1)) \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0446\u0435\u043b\u043e\u0433\u043e \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e i. (\u0417\u0434\u0435\u0441\u044c, \u043f\u0440\u0430\u0432\u0434\u0430, \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0442\u0440\u044e\u043a \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b, \u043a\u043e\u0433\u0434\u0430 k&gt;1, \u0438\u043d\u0430\u0447\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c 1). \u0412\u043e\u0442 \u043c\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0443\u043c\u043c\u0443 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 2<sup>k<\/sup>-1.  <\/div>\n<\/div>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 2<sup>3<\/sup>-1 (\u0441\u0435\u043c\u044c) \u2014 \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u043d\u0430\u0448\u0438\u0445 8-\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7. \u0411\u0435\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0431\u0438\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u0430 7 \u0438\u043b\u0438 8, \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0434\u0430\u0441\u0442 0 \u0438 1 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c: \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 8? \u0422\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 n=255. \u0410 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 0? \u0422\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 n=0. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0441\u043b\u0435 \u0432\u0437\u044f\u0442\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043d\u0430 7 \u0434\u0430\u0441\u0442 0, \u0442\u043e \u043b\u0438\u0431\u043e \u043c\u044b \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 n=0, \u043b\u0438\u0431\u043e \u0432 \u0447\u0438\u0441\u043b\u0435 \u0440\u043e\u0432\u043d\u043e 7 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442. \u0421\u0443\u043c\u043c\u0438\u0440\u0443\u044f \u044d\u0442\u0443 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3 (u8 n) {     if (n == 0)  return 0;  \/\/ \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 0.   if (n == 0xFF)  return 8;  \/\/ \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 8.   n = (0x010101*n & 0x249249) % 7;  \/\/ \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0431\u0438\u0442 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7.   if (n == 0)  return 7;  \/\/ \u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0438\u043c\u0435\u0435\u043c 7 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432.   return n;  \/\/ \u0421\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0447\u0438\u0441\u043b\u0435 \u043e\u0442 1 \u0434\u043e 6 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432. }   <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0433\u0434\u0430 n \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 16 \u0431\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e 8 \u0431\u0438\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3 (u16 n) {     return CountOnes3 (u8(n&0xFF)) + CountOnes3 (u8(n&gt;&gt;8)); <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f 32-\u0445 \u0438 64-\u0445 \u0431\u0438\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0443\u0436\u0435 \u0434\u0430\u0436\u0435 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441 \u0442\u0440\u0435\u043c\u044f \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0440\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0445 4 \u0438\u043b\u0438 8 \u0440\u0430\u0437 \u043f\u043e\u0434\u0440\u044f\u0434. \u041d\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0443\u0441\u0442\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u044b \u043c\u043d\u0435 \u043d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435 \u2013 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0438\u0445, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u0430\u043c\u0438. \u0422\u0430\u043c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u044b\u0435 \u0441 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043e\u0439 CountBits1, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 (\u044f \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SSE, \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440).  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>12,42<\/td>\n<td>30,57<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>13,88<\/td>\n<td>33,88<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<\/table>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0440\u044e\u043a, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0431\u0435\u0437 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u0432 \u0431\u043b\u043e\u043a \u0432\u043c\u0435\u0441\u0442\u0438\u043b\u0438\u0441\u044c \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 0 \u0434\u043e 8, \u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 4-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0438 \u0431\u043e\u043b\u044c\u0448\u0435). \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 4-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u00ab\u0440\u0430\u0441\u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb \u0447\u0438\u0441\u043b\u043e \u0438 \u0432\u0437\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 2<sup>4<\/sup>-1=15, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0431\u043b\u043e\u043a\u0438. \u041e\u043f\u044b\u0442\u043d\u044b\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u043a (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u043d\u0430\u0435\u0442 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443) \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0431\u0435\u0440\u0451\u0442 \u0442\u0430\u043a\u043e\u0439 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c: 0x08040201. \u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0432\u044b\u0431\u0440\u0430\u043d \u0442\u0430\u043a\u0438\u043c? <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/66f\/dfc\/e8e\/66fdfce8e5c74a67ab6b8dd61a9cfe7b.png\" width=\"100%\" \/><\/div>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u043d\u044f\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0441\u0432\u043e\u0438\u0445 4-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u0430\u0445 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0432\u044b\u0448\u0435), \u0430 \u043a\u043e\u043b\u044c \u0441\u043a\u043e\u0440\u043e 8 \u0438 4 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 8 \u0431\u0438\u0442\u043e\u0432 4 \u0440\u0430\u0437\u0430 \u043d\u0435 \u0434\u0430\u0441\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432. \u041d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0435\u043c\u0443 \u0431\u0430\u0439\u0442\u0443 \u043e\u0434\u0438\u043d \u043d\u043e\u043b\u0438\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c 9 \u0431\u0438\u0442\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a 9 \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441 4. \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0438\u0441\u043b\u043e, \u0438\u043c\u0435\u044e\u0449\u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 36 \u0431\u0438\u0442, \u043d\u043e \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0441\u0442\u043e\u044f\u0442 \u043d\u0430 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u0445 4-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u00ab\u0438\u00bb \u0441 \u0447\u0438\u0441\u043b\u043e\u043c 0x111111111 (\u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u044b\u0448\u0435), \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u043f\u043e \u0442\u0440\u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u043b\u043e\u043a\u0435. \u0417\u0430\u0442\u0435\u043c \u0431\u043b\u043e\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u043e\u0436\u0438\u0442\u044c.<\/p>\n<p>  \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 \u0431\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439:  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3_x64 (u8 n) {   return ((u64)0x08040201*n & 0x111111111) % 15; } <\/code><\/pre>\n<p>  \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d: \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434 \u0432 64-\u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 33 \u0431\u0438\u0442\u0430 \u0438\u0437 64-\u0445 (\u0441\u0442\u0430\u0440\u0448\u0438\u0435 3 \u0431\u0438\u0442\u0430 \u043e\u0431\u043d\u0443\u043b\u044f\u044e\u0442\u0441\u044f), \u0438 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 32-\u0445 \u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443, \u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b \u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0442\u0435\u043c\u0443 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u0438\u0451\u043c\u044b, \u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u0443\u0436\u0435 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. <\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442\u0438\u043c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f n, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0440\u044e\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0434\u043b\u044f \u043d\u0435\u0451. \u041a\u043e\u043b\u044c \u0441\u043a\u043e\u0440\u043e \u043c\u044b \u0431\u0435\u0440\u0451\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 15, \u0442\u0430\u043a\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043e\u043b\u044c\u0448\u0435 14 \u0431\u0438\u0442, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435. \u041d\u043e \u0434\u043b\u044f 14 \u0431\u0438\u0442 \u043f\u0440\u0438\u0451\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a 14-\u0442\u0438 \u0431\u0438\u0442\u0430\u043c \u043e\u0434\u0438\u043d \u043d\u043e\u043b\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0432\u0441\u0442\u0430\u043b\u0438 \u043d\u0430 \u0441\u0432\u043e\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u0431\u0443\u0434\u0443 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u0443\u0441\u0432\u043e\u0438\u043b\u0438 \u0441\u0443\u0442\u044c \u043f\u0440\u0438\u0451\u043c\u0430 \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u0438 \u0431\u0435\u0437 \u0442\u0440\u0443\u0434\u0430 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043c\u0430\u0441\u043a\u0443 \u0434\u043b\u044f \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432. \u041f\u043e\u043a\u0430\u0436\u0443 \u0441\u0440\u0430\u0437\u0443 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3_x64 (u14 n) { \/\/ \u042d\u0442\u043e \u043d\u0435 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 (\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c)!   return (n*0x200040008001llu & 0x111111111111111llu) % 15; } <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0448\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043c\u043e\u0433 \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u043e\u0434, \u0431\u0443\u0434\u044c \u0443 \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 14 \u0431\u0438\u0442 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430. \u042d\u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 15 \u0431\u0438\u0442, \u043d\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043b\u0438\u0448\u044c 14 \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0432\u043d\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u0435, \u043b\u0438\u0431\u043e \u0435\u0441\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 n=0x7FFF \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u042d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 u16. \u0418\u0434\u0435\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u00ab\u043e\u0442\u043a\u0443\u0441\u0438\u0442\u044c\u00bb \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u0432 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u043c\u0441\u044f 15-\u0442\u0438 \u0431\u0438\u0442\u043e\u0432\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u00ab\u043e\u0442\u043a\u0443\u0448\u0435\u043d\u043d\u044b\u0439\u00bb \u0431\u0438\u0442.  <\/p>\n<pre><code class=\"cpp\">static u8 CountOnes3_x64 (u16 n) {     u8 leastBit = n&1;  \/\/ \u0411\u0435\u0440\u0451\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442.   n &gt;&gt;= 1;  \/\/ \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e 15 \u0431\u0438\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.   if (n == 0)  return leastBit; \/\/ \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f 0, \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442.   if (n == 0x7FFF)  return leastBit + 15; \/\/ \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 15+\u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442.   return leastBit + (n*0x200040008001llu & 0x111111111111111llu) % 15;  \/\/ \u041e\u0442\u0432\u0435\u0442 (\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 14+\u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442). } <\/code><\/pre>\n<p>  \u0414\u043b\u044f n \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 32 \u0431\u0438\u0442\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u043e\u043b\u0434\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043b\u0438\u0446\u043e\u043c\u2026 \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u0442\u0432\u0435\u0442 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 6 \u0431\u0438\u0442, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 n=2<sup>32<\/sup>-1 \u0438 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442\u044b \u0432 \u043f\u043e\u043b\u044f\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 5 \u0431\u0438\u0442. \u042d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043c\u0435\u0441\u0442\u043e \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0440\u0430\u0437\u0431\u0438\u0442\u044c 32-\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0447\u0438\u0441\u043b\u0430 n \u043d\u0430 3 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e 12 \u0431\u0438\u0442 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 (\u0434\u0430, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u043c). \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 12\u22c55=60, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e 12-\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 5 \u0440\u0430\u0437, \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0432 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043b\u043e\u0436\u0438\u0442\u044c 5-\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0431\u043b\u043e\u043a\u0438, \u0432\u0437\u044f\u0432 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 31. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e 3 \u0440\u0430\u0437\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0421\u0443\u043c\u043c\u0438\u0440\u0443\u044f \u0438\u0442\u043e\u0433, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">static u8 CountOnes3_x64 ( u32 n ) {       if (n == 0)  return 0;   if (n + 1 == 0)  return 32;   u64 res = (n&0xFFF)*0x1001001001001llu & 0x84210842108421llu;   res += ((n&0xFFF000)&gt;&gt;12)*0x1001001001001llu & 0x84210842108421llu;   res += (n&gt;&gt;24)*0x1001001001001llu & 0x84210842108421llu;   res %= 0x1F;   if (res == 0)  return 31;   return res; } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u0440\u0435\u0445 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 \u0432\u0437\u044f\u0442\u044c 3 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0432\u0435\u0442\u0432\u0438\u0441\u0442\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u0430 \u043c\u043e\u0451\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  \u0414\u043b\u044f n \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 64 \u0431\u0438\u0442\u0430 \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0431\u043e 6, \u043b\u0438\u0431\u043e 7, \u0430 \u044d\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0432\u044b\u0445\u043e\u0434 \u0432 128-\u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443, \u0430 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u0439\u043c\u0438 \u043a\u0430\u043a\u0438\u043c \u00ab\u043e\u0442\u043a\u0430\u0442\u043e\u043c\u00bb \u0434\u043b\u044f \u043d\u0430\u0441 \u043e\u0431\u0435\u0440\u043d\u0451\u0442\u0441\u044f, \u043d\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043a \u0441\u0442\u0435\u043d\u043a\u0435 \u043e\u0442\u0448\u0432\u044b\u0440\u043d\u0443\u0442\u044c \ud83d\ude42<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b.   <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>39,78<\/td>\n<td>60,48<\/td>\n<td>146,78<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td> 6,78<\/td>\n<td>12,28<\/td>\n<td> 31,12<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<\/table>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0438\u0437 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e 64-\u0445 \u0431\u0438\u0442\u043e\u0432\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043f\u043b\u043e\u0445\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 32-\u0445 \u0431\u0438\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0445\u043e\u0442\u044f \u0432 \u0446\u0435\u043b\u043e\u043c-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435\u043f\u043b\u043e\u0445. \u0415\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 x64 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f u32 (24,79 \u0441), \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0442\u0441\u0442\u0430\u0451\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430 25%, \u0430 \u044d\u0442\u043e \u043f\u043e\u0432\u043e\u0434 \u043a \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044e, \u0432\u043e\u043f\u043b\u043e\u0449\u0451\u043d\u043d\u043e\u043c\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435.<\/p>\n<h4>\u0417\u0430\u043c\u0435\u043d\u0430 \u0432\u0437\u044f\u0442\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043d\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u0434\u0432\u0438\u0433<\/h4>\n<p>  \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0437\u044f\u0442\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d. \u042d\u0442\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0430 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2013 \u044d\u0442\u043e \u0434\u043e\u043b\u0433\u043e. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0437\u043d\u0430\u044e\u0442 \u0430\u043b\u0445\u0438\u043c\u0438\u044e \u0438 \u0443\u043c\u0435\u044e\u0442 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u043c, \u0430 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0438\u0437 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e \u0447\u0430\u0441\u0442\u043d\u043e\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0433\u043e! \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432 \u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u0441\u0432\u0438\u0442\u043a\u0430\u0445 \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u0442\u0435\u043b\u0435\u0439 \u043a\u043e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c k-\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435 \u0432\u0437\u044f\u0442\u0438\u0435\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0430 \u0435\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043c\u0430\u0441\u043a\u0443, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u043d\u0443\u043b\u044f\u043b\u0438 \u043b\u0438\u0448\u043d\u0438\u0435 \u0431\u0438\u0442\u044b \u0432 \u0431\u043b\u043e\u043a\u0430\u0445. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043b\u044f n \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0432 1 \u0431\u0430\u0439\u0442. <\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043d\u043e\u0432\u0430 \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u0443\u0435\u043c \u0431\u0430\u0439\u0442 \u0442\u0440\u0438\u0436\u0434\u044b \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u043e \u0434\u0432\u0430 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442\u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e 3-\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0436\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b 0x010101\u22c5n &#038; 0x249249.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/435\/d53\/ed0\/435d53ed079b455e85f6c645d222c61f.png\" width=\"80%\" \/><\/div>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0440\u0451\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u044f \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u043c\u0430\u0441\u043a\u0443 0x249249. \u041c\u0430\u0441\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0439 \u0431\u0438\u0442 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 3-\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0438\u0441\u043b\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u0441 \u0441\u043e\u0431\u043e\u0439 8 \u0440\u0430\u0437, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u043d\u0430 3 \u0431\u0438\u0442\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b13\/3cc\/325\/b133cc325a5a404193a2541a6894efe0.png\" width=\"60%\" \/><\/div>\n<p>  \u0427\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c? \u0411\u0438\u0442\u044b \u0441 21 \u043f\u043e 23 \u0438 \u0434\u0430\u044e\u0442 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443! \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0438\u0437 \u0431\u043b\u043e\u043a\u043e\u0432 \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043c \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u0430, \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e 7. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043b\u0438\u0448\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0430 \u0441\u0443\u043c\u043c\u0430 \u0440\u0430\u0432\u043d\u0430 8, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c 0, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u0432\u0435\u0434\u044c \u044d\u0442\u043e\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3_x64_m (u8 n) {     if (n == 0xFF)  return 8;   return ((u64(0x010101*n & 0x249249) * 0x249249) &gt;&gt; 21) & 0x7; } <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u044b \u0432\u0437\u044f\u043b\u0438 \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u0432 \u043d\u0451\u043c \u0432\u0437\u044f\u0442\u0438\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 7 \u043d\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u0434\u0432\u0438\u0433 \u0438 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u00ab\u0418\u00bb \u0432 \u043a\u043e\u043d\u0446\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043c\u0435\u0441\u0442\u043e 3-\u0445 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f 16 \u0431\u0438\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0437\u044f\u0442\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 15 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0442\u043e, \u043a\u0430\u043a\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0434\u0430.  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3_x64_m (u16 n) {       u8 leastBit = n&1; \/\/ \u0411\u0435\u0440\u0451\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442   n &gt;&gt;= 1; \/\/ \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e 15 \u0431\u0438\u0442.   return leastBit   + (( (n*0x200040008001llu & 0x111111111111111llu)*0x111111111111111llu         &gt;&gt; 56) & 0xF); \/\/ \u041e\u0442\u0432\u0435\u0442 (\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 15 + \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442). } <\/code><\/pre>\n<p>  \u0414\u043b\u044f 32-\u0445 \u0431\u0438\u0442 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: \u0431\u0435\u0440\u0451\u043c \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0438, \u043f\u043e\u0440\u0438\u0441\u043e\u0432\u0430\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435, \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0432\u0438\u0433, \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043d\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435.  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes3_x64_m ( u32 n ) {       if (n+1 == 0)  return 32;   u64 res = (n&0xFFF)*0x1001001001001llu & 0x84210842108421llu;   res += ((n&0xFFF000)&gt;&gt;12)*0x1001001001001llu & 0x84210842108421llu;   res += (n&gt;&gt;24)*0x1001001001001llu & 0x84210842108421llu;   return (res*0x84210842108421llu &gt;&gt; 55) & 0x1F; } <\/code><\/pre>\n<p>  \u0414\u043b\u044f 64-\u0445 \u0431\u0438\u0442 \u044f \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0435\u0433\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u043e \u0431\u044b \u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u043e\u043b\u044c \u043f\u0435\u0447\u043a\u0438.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>12,66<\/td>\n<td>42,37<\/td>\n<td>99,90<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td> 3,54<\/td>\n<td> 4,51<\/td>\n<td>18,35<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<\/table>\n<p>  \u041f\u0440\u0438\u044f\u0442\u043d\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 x64. \u041a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u043c\u044b \u043e\u0431\u043e\u0433\u043d\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442 \u0441 \u043e\u0434\u043d\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f u32. \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0431\u043e\u0433\u043d\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442? \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \ud83d\ude42<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0442\u0440\u044e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u0442\u0435\u043b\u0438, \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044f, \u043a\u0430\u043a \u043e\u043d \u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 1 \u0431\u0430\u0439\u0442\u0430. \u0411\u0430\u0439\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4-\u0445 \u043f\u043e\u043b\u0435\u0439 \u043f\u043e 2 \u0431\u0438\u0442\u0430, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0442\u044b \u0432 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u044f\u0445, \u043f\u0440\u043e\u0438\u0437\u043d\u0435\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:  <\/p>\n<pre><code class=\"cpp\">n = (n&gt;&gt;1)&0x55 + (n&0x55); <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438):  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/823\/dfa\/365\/823dfa36591249c1a46fa04ab5d15884.png\" width=\"60%\" \/><\/div>\n<p>  \u041e\u0434\u043d\u043e \u0438\u0437 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u00ab\u0418\u00bb \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0432\u0443\u0445\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430, \u0432\u0442\u043e\u0440\u043e\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b, \u043d\u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u0438\u0445 \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0438\u0442\u0430\u043c. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0434\u0432\u0443\u0445\u0431\u0438\u0442\u043e\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0435 (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u044b\u0448\u0435).<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043b\u043e\u0436\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0434\u0432\u0443\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f\u0445, \u043f\u043e\u043c\u0435\u0449\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 2 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f:  <\/p>\n<pre><code class=\"cpp\">n = (n&gt;&gt;2)&0x33 + (n&0x33); <\/code><\/pre>\n<p>  \u041d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u043e\u044f\u0441\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u0435\u0451 \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u043b\u043e\u0432:  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/420\/531\/ef9\/420531ef916b487eba7b4ed558a016ec.png\" width=\"60%\" \/><\/div>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043b\u043e\u0436\u0438\u043c \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f\u0445:  <\/p>\n<pre><code class=\"cpp\">n = (n&gt;&gt;4)&0x0F + (n&0x0F); <\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f95\/cdc\/e28\/f95cdce2891b4a3fbfbd5cee9230e3a3.png\" width=\"60%\" \/><\/div>\n<p>  \u0414\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u0451\u043c \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0438\u0442, \u0440\u0430\u0432\u043d\u043e\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u0427\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c\u0443 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0443 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u0442. \u0423\u043b\u043e\u0432\u0438\u0432 \u0438\u0434\u0435\u044e, \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u0432\u0441\u043a\u043e\u043b\u044c\u0437\u044c \u043d\u0430 4 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f.  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4 (u8 n) {   n = ((n&gt;&gt;1) & 0x55) + (n & 0x55);   n = ((n&gt;&gt;2) & 0x33) + (n & 0x33);   n = ((n&gt;&gt;4) & 0x0F) + (n & 0x0F);   return n; } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4 (u16 n) {   n = ((n&gt;&gt;1) & 0x5555) + (n & 0x5555);   n = ((n&gt;&gt;2) & 0x3333) + (n & 0x3333);   n = ((n&gt;&gt;4) & 0x0F0F) + (n & 0x0F0F);   n = ((n&gt;&gt;8) & 0x00FF) + (n & 0x00FF);   return n; } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4 (u32 n) {   n = ((n&gt;&gt;1) & 0x55555555) + (n & 0x55555555);   n = ((n&gt;&gt;2) & 0x33333333) + (n & 0x33333333);   n = ((n&gt;&gt;4) & 0x0F0F0F0F) + (n & 0x0F0F0F0F);   n = ((n&gt;&gt;8) & 0x00FF00FF) + (n & 0x00FF00FF);   n = ((n&gt;&gt;16) & 0x0000FFFF) + (n & 0x0000FFFF);   return n; } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4 (u64 n) {   n = ((n&gt;&gt;1) & 0x5555555555555555llu) + (n & 0x5555555555555555llu);   n = ((n&gt;&gt;2) & 0x3333333333333333llu) + (n & 0x3333333333333333llu);   n = ((n&gt;&gt;4) & 0x0F0F0F0F0F0F0F0Fllu) + (n & 0x0F0F0F0F0F0F0F0Fllu);   n = ((n&gt;&gt;8) & 0x00FF00FF00FF00FFllu) + (n & 0x00FF00FF00FF00FFllu);   n = ((n&gt;&gt;16) & 0x0000FFFF0000FFFFllu) + (n & 0x0000FFFF0000FFFFllu);   n = ((n&gt;&gt;32) & 0x00000000FFFFFFFFllu) + (n & 0x00000000FFFFFFFFllu);   return n; } <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0420\u0430\u0437\u0432\u0438\u0442\u044c \u0438\u0434\u0435\u044e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u0434\u0432\u0430\u0436\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0431\u0438\u0442\u043e\u0432\u0430\u044f \u043c\u0430\u0441\u043a\u0430, \u0447\u0442\u043e \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043d\u0430\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u043c\u044b\u0441\u043b\u044c \u00ab\u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u00ab\u0418\u00bb?\u00bb. \u041c\u043e\u0436\u043d\u043e, \u043d\u043e \u043d\u0435 \u0441\u0440\u0430\u0437\u0443. \u0412\u043e\u0442 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u0434 \u0434\u043b\u044f u32 (\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438).  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4 (u32 n) {   n = ((n&gt;&gt;1) & 0x55555555) + (n & 0x55555555);  \/\/ \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c   n = ((n&gt;&gt;2) & 0x33333333) + (n & 0x33333333); \/\/ \u041d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c   n = ((n&gt;&gt;4) & 0x0F0F0F0F) + (n & 0x0F0F0F0F); \/\/ \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 & \u0437\u0430 \u0441\u043a\u043e\u0431\u043a\u0443   n = ((n&gt;&gt;8) & 0x00FF00FF) + (n & 0x00FF00FF); \/\/ \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 & \u0437\u0430 \u0441\u043a\u043e\u0431\u043a\u0443   n = ((n&gt;&gt;16) & 0x0000FFFF) + (n & 0x0000FFFF); \/\/ \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0443\u0431\u0440\u0430\u0442\u044c &   return n; \/\/ \u041d\u0435\u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435 \u043f\u043e 8-\u0438 \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0438\u0442\u0430\u043c. } <\/code><\/pre>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0447\u043d\u044b\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e. \u0414\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u044f \u0434\u0430\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443, \u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u043d\u0435\u0451 \u0441\u0440\u0430\u0437\u0443:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0432\u0443\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a ab \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 2a+b, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0440\u0430\u0432\u043d\u044b\u043c\u2026?  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes4_opt (u32 n) {   n -= (n&gt;&gt;1) & 0x55555555;   n = ((n&gt;&gt;2) & 0x33333333 ) + (n & 0x33333333);   n = ((n&gt;&gt;4) + n) & 0x0F0F0F0F;   n = ((n&gt;&gt;8) + n) & 0x00FF00FF;   n = ((n&gt;&gt;16) + n);   return n; } <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0438 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: \u043e\u0434\u043d\u0430 \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e.  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>7,52<\/td>\n<td>14,10<\/td>\n<td>21,12<\/td>\n<td>62,70<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>8,06<\/td>\n<td>11,89<\/td>\n<td>21,30<\/td>\n<td>22,59<\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<table>\n<tr>\n<th>\u0420\u0435\u0436\u0438\u043c<\/th>\n<th>u8<\/th>\n<th>u16<\/th>\n<th>u32<\/th>\n<th>u64<\/th>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>7,18<\/td>\n<td>11,89<\/td>\n<td>18,86<\/td>\n<td>65,00<\/td>\n<\/tr>\n<tr>\n<td>x64<\/td>\n<td>8,09<\/td>\n<td>10,27<\/td>\n<td>19,20<\/td>\n<td>19,20<\/td>\n<\/tr>\n<\/table>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 x86 \u0434\u043b\u044f u64.<\/p>\n<h4>\u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/h4>\n<p>  \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u2013 \u044d\u0442\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 (\u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439) \u0438 \u043c\u0435\u0442\u043e\u0434 \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0441\u0443\u043c\u043c\u044b \u0431\u043b\u043e\u043a\u043e\u0432. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0442\u043e\u0447\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0430\u0439\u0442\u0435 \u0447\u0438\u0441\u043b\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f u32 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"cpp\">  n -= (n&gt;&gt;1) & 0x55555555;   n = ((n&gt;&gt;2) & 0x33333333) + (n & 0x33333333);   n = (((n&gt;&gt;4) + n) & 0x0F0F0F0F ); <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0435 \u0447\u0438\u0441\u043b\u043e n \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4 \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a 4 \u0447\u0438\u0441\u043b\u0430, \u0441\u0443\u043c\u043c\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0438\u0449\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fc9\/114\/46c\/fc911446cb3d40299c9765dd059baea2.png\" width=\"25%\" \/><\/div>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0441\u0443\u043c\u043c\u0443 \u044d\u0442\u0438\u0445 4-\u0445 \u0431\u0430\u0439\u0442, \u0435\u0441\u043b\u0438 \u0443\u043c\u043d\u043e\u0436\u0438\u043c \u0447\u0438\u0441\u043b\u043e n \u043d\u0430 0x01010101. \u0412\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u0432\u0435\u0442, \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a5e\/464\/d55\/a5e464d55eba46508d424d51c91c211a.png\" width=\"30%\" \/><\/div>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 3-\u0431\u0430\u0439\u0442\u0435 (\u0435\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u043e\u0442 0). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c \u0434\u043b\u044f u32 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes5 ( u32 n ) {   n -= (n&gt;&gt;1) & 0x55555555;   n = ((n&gt;&gt;2) & 0x33333333 ) + (n & 0x33333333);   n = ((((n&gt;&gt;4) + n) & 0x0F0F0F0F) * 0x01010101) &gt;&gt; 24;   return n; \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435 \u043f\u043e 8 \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0438\u0442\u0430\u043c. } <\/code><\/pre>\n<p>  \u041e\u043d \u0436\u0435 \u0434\u043b\u044f u16:  <\/p>\n<pre><code class=\"cpp\">static u8 CountOnes5 (u16 n) {   n -= (n&gt;&gt;1) & 0x5555;   n = ((n&gt;&gt;2) & 0x3333) + (n & 0x3333);   n = ((((n&gt;&gt;4) + n) & 0x0F0F) * 0x0101) &gt;&gt; 8;   return n; \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435 \u043f\u043e 8 \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0438\u0442\u0430\u043c. } <\/code><\/pre>\n<p>  \u041e\u043d \u0436\u0435 \u0434\u043b\u044f u64:  <\/p>\n<pre><code class=\"cpp\">u8 CountOnes5 ( u64 n ) {   n -= (n&gt;&gt;1) & 0x5555555555555555llu;   n = ((n&gt;&gt;2) & 0x3333333333333333llu ) + (n & 0x3333333333333333llu);   n = ((((n&gt;&gt;4) + n) & 0x0F0F0F0F0F0F0F0Fllu)        * 0x0101010101010101) &gt;&gt; 56;   return n; \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435 \u043f\u043e 8 \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0438\u0442\u0430\u043c. } <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u044b, \u0438\u0437\u0443\u0447\u0438\u0432 \u0434\u0432\u0435 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412 \u043d\u0438\u0445 \u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u0435\u0442\u0438\u043b \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u043c\u043a\u043e\u0439 \u0442\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0422\u0435\u0445, \u043a\u0442\u043e \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0447\u0451\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442, \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437 \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 x64.<\/p>\n<p>  \u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 x86.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/dc6\/49c\/e47\/dc649ce471ef4b6e8fca8e1534a3ecaf.png\"\/><\/p>\n<p>  \u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 x64.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e7c\/fb4\/365\/e7cfb43659b540988c2d99eb7463e1d6.png\"\/><\/p>\n<h4>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0438 \u0432 \u043a\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u0438\u0442\u043e\u0433\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043a\u0430\u043a \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u041f\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0438 \u0441 \u0432\u0430\u0448\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0438\u043d\u044b\u043c\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041f\u043e\u0434 \u043a\u0430\u0436\u0434\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0442\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>  \u042f \u0438\u0437\u043b\u043e\u0436\u0438\u043b \u0442\u0435 \u0438\u0434\u0435\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u043d\u0430\u044e \u0441\u0430\u043c, \u043d\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0438\u0434\u0435\u0438, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u044d\u0442\u0438 \u0438\u0434\u0435\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u0432\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447!               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/276957\/\"> https:\/\/habrahabr.ru\/post\/276957\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0425\u0430\u0431\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043e\u0442 8 \u0434\u043e 64 \u0431\u0438\u0442\u043e\u0432. \u042d\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0443 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u00ab\u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0433\u0438\u0438\u00bb \u0438\u043b\u0438 \u00ab\u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0438\u00bb, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u043e\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043a\u0440\u0430\u0441\u043e\u0442\u043e\u0439 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u044d\u0442\u043e\u0439 \u0430\u043b\u0445\u0438\u043c\u0438\u0438 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0438 \u0432\u044b \u0434\u0430\u0436\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0451\u043c\u0430\u043c\u0438, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-274210","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/274210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=274210"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/274210\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=274210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=274210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=274210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}