Mercurial > hg > qm-dsp
comparison ext/cblas/src/lsame.c @ 430:335af74a25b6
Merge from branch clapack-included
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 30 Sep 2016 16:24:24 +0100 |
parents | 905e45637745 |
children |
comparison
equal
deleted
inserted
replaced
426:a23b9f8b4a59 | 430:335af74a25b6 |
---|---|
1 /* lsame.f -- translated by f2c (version 20061008). | |
2 You must link the resulting object file with libf2c: | |
3 on Microsoft Windows system, link with libf2c.lib; | |
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm | |
5 or, if you install libf2c.a in a standard place, with -lf2c -lm | |
6 -- in that order, at the end of the command line, as in | |
7 cc *.o -lf2c -lm | |
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., | |
9 | |
10 http://www.netlib.org/f2c/libf2c.zip | |
11 */ | |
12 | |
13 #include "f2c.h" | |
14 #include "blaswrap.h" | |
15 | |
16 logical lsame_(char *ca, char *cb) | |
17 { | |
18 /* System generated locals */ | |
19 logical ret_val; | |
20 | |
21 /* Local variables */ | |
22 integer inta, intb, zcode; | |
23 | |
24 | |
25 /* -- LAPACK auxiliary routine (version 3.1) -- */ | |
26 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ | |
27 /* November 2006 */ | |
28 | |
29 /* .. Scalar Arguments .. */ | |
30 /* .. */ | |
31 | |
32 /* Purpose */ | |
33 /* ======= */ | |
34 | |
35 /* LSAME returns .TRUE. if CA is the same letter as CB regardless of */ | |
36 /* case. */ | |
37 | |
38 /* Arguments */ | |
39 /* ========= */ | |
40 | |
41 /* CA (input) CHARACTER*1 */ | |
42 | |
43 /* CB (input) CHARACTER*1 */ | |
44 /* CA and CB specify the single characters to be compared. */ | |
45 | |
46 /* ===================================================================== */ | |
47 | |
48 /* .. Intrinsic Functions .. */ | |
49 /* .. */ | |
50 /* .. Local Scalars .. */ | |
51 /* .. */ | |
52 | |
53 /* Test if the characters are equal */ | |
54 | |
55 ret_val = *(unsigned char *)ca == *(unsigned char *)cb; | |
56 if (ret_val) { | |
57 return ret_val; | |
58 } | |
59 | |
60 /* Now test for equivalence if both characters are alphabetic. */ | |
61 | |
62 zcode = 'Z'; | |
63 | |
64 /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */ | |
65 /* machines, on which ICHAR returns a value with bit 8 set. */ | |
66 /* ICHAR('A') on Prime machines returns 193 which is the same as */ | |
67 /* ICHAR('A') on an EBCDIC machine. */ | |
68 | |
69 inta = *(unsigned char *)ca; | |
70 intb = *(unsigned char *)cb; | |
71 | |
72 if (zcode == 90 || zcode == 122) { | |
73 | |
74 /* ASCII is assumed - ZCODE is the ASCII code of either lower or */ | |
75 /* upper case 'Z'. */ | |
76 | |
77 if (inta >= 97 && inta <= 122) { | |
78 inta += -32; | |
79 } | |
80 if (intb >= 97 && intb <= 122) { | |
81 intb += -32; | |
82 } | |
83 | |
84 } else if (zcode == 233 || zcode == 169) { | |
85 | |
86 /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */ | |
87 /* upper case 'Z'. */ | |
88 | |
89 if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta | |
90 >= 162 && inta <= 169) { | |
91 inta += 64; | |
92 } | |
93 if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb | |
94 >= 162 && intb <= 169) { | |
95 intb += 64; | |
96 } | |
97 | |
98 } else if (zcode == 218 || zcode == 250) { | |
99 | |
100 /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */ | |
101 /* plus 128 of either lower or upper case 'Z'. */ | |
102 | |
103 if (inta >= 225 && inta <= 250) { | |
104 inta += -32; | |
105 } | |
106 if (intb >= 225 && intb <= 250) { | |
107 intb += -32; | |
108 } | |
109 } | |
110 ret_val = inta == intb; | |
111 | |
112 /* RETURN */ | |
113 | |
114 /* End of LSAME */ | |
115 | |
116 return ret_val; | |
117 } /* lsame_ */ |