• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/cache-calibrator/0001-Fix-conflicting-round-function.patch
Peter KorsgaardPeter Korsgaard committed 298cd8eaa2103 Feb 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
2
From: Stephan Hoffmann <sho@relinux.de>
3
Date: Mon, 28 Jan 2013 17:32:10 +0100
4
Subject: [PATCH] Fix conflicting round() function
5
​
6
calibrator.c defines a local round() function that conflicts
7
with the one from the standard library.
8
​
9
This is fixed by renaming the local function.
10
​
11
Signed-off-by: Stephan Hoffmann <sho@relinux.de>
12
---
13
 calibrator.c |   30 +++++++++++++++---------------
14
 1 files changed, 15 insertions(+), 15 deletions(-)
15
​
16
diff --git a/calibrator.c b/calibrator.c
17
index e045dfd..8471c04 100644
18
--- a/calibrator.c
19
+++ b/calibrator.c
20
@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
21
    exit(1);
22
 }
23
 
24
-lng round(dbl x)
25
+lng lng_round(dbl x)
26
 {
27
    return (lng)(x + 0.5);
28
 }
29
@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
30
    fprintf(fp, ")\n");
31
    fprintf(fp, "set y2tics");
32
    for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
33
-       if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
34
-           else    fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
35
+       if (!delay) fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
36
+           else    fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
37
    }
38
    for (y = 1; y <= yh; y *= 10) {
39
        fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
40
    }
41
    fprintf(fp, ")\n");
42
    for (l = 0; l <= cache->levels; l++) {
43
-       if (!delay) z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
44
-           else    z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
45
+       if (!delay) z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
46
+           else    z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
47
        fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
48
        fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
49
    }
50
@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
51
    fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
52
    fprintf(fp, "set y2tics");
53
    for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
54
-       if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
55
-           else    fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
56
+       if (!delay) fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
57
+           else    fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
58
    }
59
    for (y = 1; y <= yh; y *= 10) {
60
        fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
61
    }
62
    fprintf(fp, ")\n");
63
    for (l = 0; l <= TLB->levels; l++) {
64
-       if (!delay) z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
65
-           else    z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
66
+       if (!delay) z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
67
+           else    z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
68
        fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
69
        fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
70
    }
71
@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
72
    FILE    *fp = stdout;
73
        
74
    fprintf(fp, "CPU loop + L1 access:    ");
75
-   fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
76
+   fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
77
    fprintf(fp, "             ( delay:    ");
78
-   fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
79
+   fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
80
    fprintf(fp, "\n");
81
    fflush(fp);
82
 }
83
@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
84
            fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
85
        }
86
        fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
87
-       fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
88
-       fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
89
+       fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
90
+       fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
91
    }
92
    fprintf(fp, "\n");
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.