23 #if defined (HAVE_CONFIG_H)
70 if (nargin < 1 || nargin > 2)
73 if (nargin == 2 && !
args(1).is_string ())
74 error (
"hex2num: CLASS must be a string");
78 bool is_single = (prec ==
"single");
82 error (
"hex2num: S must be no more than %d characters", nchars);
83 else if (prec !=
"double" && prec !=
"single")
84 error (
"hex2num: CLASS must be either \"double\" or \"single\"");
106 unsigned char ch = cmat.
elem (
i, j);
109 error (
"hex2num: illegal character found in string S");
113 num.ival +=
static_cast<uint32_t
> (ch -
'a' + 10);
115 num.ival +=
static_cast<uint32_t
> (ch -
'A' + 10);
117 num.ival +=
static_cast<uint32_t
> (ch -
'0');
121 num.ival <<= (nchars - nc) * 4;
144 unsigned char ch = cmat.
elem (
i, j);
147 error (
"hex2num: illegal character found in string S");
151 num.ival +=
static_cast<uint64_t
> (ch -
'a' + 10);
153 num.ival +=
static_cast<uint64_t
> (ch -
'A' + 10);
155 num.ival +=
static_cast<uint64_t
> (ch -
'0');
159 num.ival <<= (nchars - nc) * 4;
208 if (
args.length () != 1)
211 if (
args(0).is_complex_type ())
212 error (
"num2hex: N must be real");
216 if (
args(0).is_single_type ())
223 const float *pv = v.fortran_vec ();
238 static_cast<char>(num.ival >> ((nchars - 1 - j) * 4) & 0xF);
257 const double *pv = v.fortran_vec ();
272 static_cast<char>(num.ival >> ((nchars - 1 - j) * 4) & 0xF);
treats each row as a separate number xample roup hex2num(["4005bf0a8b145769";"4024000000000000"]) esult
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
T & elem(octave_idx_type n)
octave_idx_type rows(void) const
nd deftypefn *octave_map m
=val(i)}if ode{val(i)}occurs in table i
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
octave_idx_type columns(void) const