DELIMITER $$DROP FUNCTION IF EXISTS `value_of_bit_index`$$/*计算数字的某个位的值*/CREATE FUNCTION `value_of_bit_index`(`number` int, `idx` int) RETURNS int(11)BEGINRETURN (`number` >> (`idx`-1)) ^ ((`number` >> `idx`-1) &~1);END$$DELIMITER ;