let get_max_value_of_type t = 
  match t.ct_ty with
  | Tbuiltin (Tfloat | Tdouble | Tlongdouble->
      failwith "get_max_value_of_type: floating not supported"
  | Tbuiltin bt ->
      let s = size_of_builtin_type bt in
      let is_signed = 
        match bt with
          Tschar | Tshort | Tint | Tlong | Tlonglong -> true
        | Tuchar | Tushort | Tuint | Tulong | Tulonglong -> false
        | Tchar -> Config.char_is_signed
        | Tfloat | Tdouble | Tlongdouble -> assert false
      in
      let bits = s * bits_of_byte - (if is_signed then 1 else 0) in
      sub_big_int (Big_int.power_int_positive_int 2 bits) unit_big_int
  | _ ->
      failwith "get_max_value_of_type: not builtin numeric type"