null+****@clear*****
null+****@clear*****
2012年 6月 6日 (水) 10:50:38 JST
HAYASHI Kentaro 2012-06-06 10:50:38 +0900 (Wed, 06 Jun 2012)
New Revision: 28d4d889daf560108cb7cb36b2d6022652fa2792
Log:
geo: summarize the condition check
refs #1386
This fix improves the performance penalty introduced at revision 397bbc80
Modified files:
lib/geo.c
Modified: lib/geo.c (+1 -4)
===================================================================
--- lib/geo.c 2012-06-05 19:07:51 +0900 (c67eab5)
+++ lib/geo.c 2012-06-06 10:50:38 +0900 (c49422a)
@@ -1935,10 +1935,7 @@ grn_geo_distance_rectangle_raw(grn_ctx *ctx,
lat2 = GRN_GEO_INT2RAD(point2->latitude);
lng2 = GRN_GEO_INT2RAD(point2->longitude);
quad_type = geo_quadrant_type(point1, point2);
- if (quad_type == QUADRANT_1ST ||
- quad_type == QUADRANT_2ND ||
- quad_type == QUADRANT_3RD ||
- quad_type == QUADRANT_4TH) {
+ if (quad_type <= QUADRANT_4TH) {
x = (lng2 - lng1) * cos((lat1 + lat2) * 0.5);
y = (lat2 - lat1);
distance = sqrt((x * x) + (y * y)) * GRN_GEO_RADIUS;