+/* descriptor_to_basic_type ****************************************************
+
+ Return the basic type to use for a value with this descriptor.
+
+ IN:
+ utf..............descriptor utf string
+
+ OUT:
+ A TYPE_* constant.
+
+ PRECONDITIONS:
+ This function assumes that the descriptor has passed
+ descriptor_pool_add checks and that it does not start with '('.
+
+*******************************************************************************/
+
+u2 descriptor_to_basic_type(utf *descriptor)
+{
+ assert(descriptor->blength >= 1);
+
+ switch (descriptor->text[0]) {
+ case 'B':
+ case 'C':
+ case 'I':
+ case 'S':
+ case 'Z': return TYPE_INT;
+ case 'D': return TYPE_DBL;
+ case 'F': return TYPE_FLT;
+ case 'J': return TYPE_LNG;
+ case 'L':
+ case '[': return TYPE_ADR;
+ }
+
+ assert(0);
+
+ return 0; /* keep the compiler happy */
+}
+
+/* descriptor_typesize**** ****************************************************
+
+ Return the size in bytes needed for the given type.
+
+ IN:
+ td..............typedesc describing the type
+
+ OUT:
+ The number of bytes
+
+*******************************************************************************/
+
+u2 descriptor_typesize(typedesc *td)
+{
+ assert(td);
+
+ switch (td->type) {
+ case TYPE_INT: return 4;
+ case TYPE_LNG: return 8;
+ case TYPE_FLT: return 4;
+ case TYPE_DBL: return 8;
+ case TYPE_ADR: return sizeof(voidptr);
+ }
+
+ assert(0);
+
+ return 0; /* keep the compiler happy */
+}