emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/osm 7d79bb9ba5: Inline functions. For some reason this


From: ELPA Syncer
Subject: [elpa] externals/osm 7d79bb9ba5: Inline functions. For some reason this seemingly reduces allocations.
Date: Wed, 11 May 2022 06:57:42 -0400 (EDT)

branch: externals/osm
commit 7d79bb9ba5aaeba094829e967d5d6b316509de83
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Inline functions. For some reason this seemingly reduces allocations.
    
    Who knows why? These functions should be non-allocating...
---
 osm.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/osm.el b/osm.el
index d655fbf328..08559316d8 100644
--- a/osm.el
+++ b/osm.el
@@ -403,6 +403,15 @@ Should be at least 7 days according to the server usage 
policies."
          menu)))
     (nreverse menu)))
 
+(defsubst osm--lon-to-normalized-x (lon)
+  "Convert LON to normalized x coordinate."
+  (/ (+ lon 180.0) 360.0))
+
+(defsubst osm--lat-to-normalized-y (lat)
+  "Convert LAT to normalized y coordinate."
+  (setq lat (* lat (/ float-pi 180.0)))
+  (- 0.5 (/ (log (+ (tan lat) (/ 1.0 (cos lat)))) float-pi 2)))
+
 (defun osm--boundingbox-to-zoom (lat1 lat2 lon1 lon2)
   "Compute zoom level from boundingbox LAT1 to LAT2 and LON1 to LON2."
   (let ((w (/ (frame-pixel-width) 256))
@@ -413,15 +422,6 @@ Should be at least 7 days according to the server usage 
policies."
           (min (logb (/ w (abs (- (osm--lon-to-normalized-x lon1) 
(osm--lon-to-normalized-x lon2)))))
                (logb (/ h (abs (- (osm--lat-to-normalized-y lat1) 
(osm--lat-to-normalized-y lat2))))))))))
 
-(defun osm--lon-to-normalized-x (lon)
-  "Convert LON to normalized x coordinate."
-  (/ (+ lon 180.0) 360.0))
-
-(defun osm--lat-to-normalized-y (lat)
-  "Convert LAT to normalized y coordinate."
-  (setq lat (* lat (/ float-pi 180.0)))
-  (- 0.5 (/ (log (+ (tan lat) (/ 1 (cos lat)))) float-pi 2)))
-
 (defun osm--x-to-lon (x zoom)
   "Return longitude in degrees for X/ZOOM."
   (- (/ (* x 360.0) 256.0 (expt 2.0 zoom)) 180.0))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]