[libchamplain] Replace pow() with bit shift to be sure we are fast
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Replace pow() with bit shift to be sure we are fast
- Date: Tue, 23 Mar 2010 14:41:40 +0000 (UTC)
commit 6ef07ebbfd4e256d116878470ffe339620932918
Author: JiÅ?Ã Techet <techet gmail com>
Date: Mon Mar 15 01:02:29 2010 +0100
Replace pow() with bit shift to be sure we are fast
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain/champlain-map-source.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c
index 613fe45..c3dc82e 100644
--- a/champlain/champlain-map-source.c
+++ b/champlain/champlain-map-source.c
@@ -559,7 +559,7 @@ champlain_map_source_get_row_count (ChamplainMapSource *map_source,
//ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
- return pow (2, zoom_level);
+ return (zoom_level != 0) ? 2 << (zoom_level - 1) : 1;
}
/**
@@ -582,7 +582,7 @@ champlain_map_source_get_column_count (ChamplainMapSource *map_source,
//ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
- return pow (2, zoom_level);
+ return (zoom_level != 0) ? 2 << (zoom_level - 1) : 1;
}
#define EARTH_RADIUS 6378137.0 /* meters, Equatorial radius */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]