absyntax_utils/absyntax_utils.cc
changeset 565 8acbddf75333
parent 564 dabffc3086dc
child 567 e5deeb6d4d2f
equal deleted inserted replaced
564:dabffc3086dc 565:8acbddf75333
   115   /* return atoi(str.c_str()); */
   115   /* return atoi(str.c_str()); */
   116   return atoll(str.c_str());
   116   return atoll(str.c_str());
   117 }
   117 }
   118 
   118 
   119 uint64_t extract_hex_value(symbol_c *sym) {
   119 uint64_t extract_hex_value(symbol_c *sym) {
   120 	std::string str = "";
   120   std::string str = "";
   121 	char *endptr;
   121   char *endptr;
   122 	hex_integer_c * hex_integer;
   122   hex_integer_c * hex_integer;
   123 	uint64_t ret;
   123   uint64_t ret;
   124 
   124 
   125     if ((hex_integer = dynamic_cast<hex_integer_c *>(sym)) == NULL) ERROR;
   125   if ((hex_integer = dynamic_cast<hex_integer_c *>(sym)) == NULL) ERROR;
   126     for(unsigned int i = 3; i < strlen(hex_integer->value); i++)
   126   for(unsigned int i = 3; i < strlen(hex_integer->value); i++)
   127     	if (hex_integer->value[i] != '_') str += hex_integer->value[i];
   127     if (hex_integer->value[i] != '_') str += hex_integer->value[i];
   128     errno = 0;    /* To distinguish success/failure after call */
   128   errno = 0;    /* To distinguish success/failure after call */
   129     ret = strtol(str.c_str(), &endptr, 16);
   129   ret = strtoull(str.c_str(), &endptr, 16);
   130     if (errno != 0) ERROR;
   130   if (errno != 0) ERROR;
   131 
   131 
   132 	return ret;
   132   return ret;
   133 }
   133 }
   134 
   134 
   135 
   135 
   136 
   136 
   137 /***********************************************************************/
   137 /***********************************************************************/