1 /* lsame.f -- translated by f2c (version 19991025).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 #include "blis.h"
11 logical bli_lsame(character *ca, character *cb, ftnlen ca_len, ftnlen cb_len)
12 {
13 /* System generated locals */
14 logical ret_val;
16 /* Local variables */
17 static integer inta, intb, zcode;
20 /* -- LAPACK auxiliary routine (version 3.2) -- */
21 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
22 /* November 2006 */
24 /* .. Scalar Arguments .. */
25 /* .. */
27 /* Purpose */
28 /* ======= */
30 /* LSAME returns .TRUE. if CA is the same letter as CB regardless of */
31 /* case. */
33 /* Arguments */
34 /* ========= */
36 /* CA (input) CHARACTER*1 */
37 /* CB (input) CHARACTER*1 */
38 /* CA and CB specify the single characters to be compared. */
40 /* ===================================================================== */
42 /* .. Intrinsic Functions .. */
43 /* .. */
44 /* .. Local Scalars .. */
45 /* .. */
46 /* .. Executable Statements .. */
48 /* Test if the characters are equal */
50 ret_val = *(unsigned char *)ca == *(unsigned char *)cb;
51 if (ret_val) {
52 return ret_val;
53 }
55 /* Now test for equivalence if both characters are alphabetic. */
57 zcode = 'Z';
59 /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */
60 /* machines, on which ICHAR returns a value with bit 8 set. */
61 /* ICHAR('A') on Prime machines returns 193 which is the same as */
62 /* ICHAR('A') on an EBCDIC machine. */
64 inta = *(unsigned char *)ca;
65 intb = *(unsigned char *)cb;
67 if (zcode == 90 || zcode == 122) {
69 /* ASCII is assumed - ZCODE is the ASCII code of either lower or */
70 /* upper case 'Z'. */
72 if (inta >= 97 && inta <= 122) {
73 inta += -32;
74 }
75 if (intb >= 97 && intb <= 122) {
76 intb += -32;
77 }
79 } else if (zcode == 233 || zcode == 169) {
81 /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */
82 /* upper case 'Z'. */
84 if ((inta >= 129 && inta <= 137) || (inta >= 145 && inta <= 153) || (inta
85 >= 162 && inta <= 169)) {
86 inta += 64;
87 }
88 if ((intb >= 129 && intb <= 137) || (intb >= 145 && intb <= 153) || (intb
89 >= 162 && intb <= 169)) {
90 intb += 64;
91 }
93 } else if (zcode == 218 || zcode == 250) {
95 /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */
96 /* plus 128 of either lower or upper case 'Z'. */
98 if (inta >= 225 && inta <= 250) {
99 inta += -32;
100 }
101 if (intb >= 225 && intb <= 250) {
102 intb += -32;
103 }
104 }
105 ret_val = inta == intb;
107 /* RETURN */
109 /* End of LSAME */
111 return ret_val;
112 } /* bli_lsame */
114 #ifdef __cplusplus
115 }
116 #endif