summaryrefslogtreecommitdiff
path: root/util.c
blob: 4bb44e49023f741a20d6ddb62679f58ffdff3967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "util.h"

static char buf[22];

const char *
get_url(int zoom, int x, int y)
{
   int xq, yq, val;
   xq = x;
   yq = y;
   buf[zoom] = '\0';
   while (zoom > 0)
     {
        val = (xq % 2) + (yq % 2) * 2;
        xq /= 2;
        yq /= 2;
		buf[zoom - 1] = val + 0x30;
        zoom--;
     }
   return buf;
}