You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/06/04 18:46:32 UTC
[38/50] [abbrv] git commit: TS-1648: use int64_t for bucket indexes
(in case there are more than 2^31).
TS-1648: use int64_t for bucket indexes (in case there are more than 2^31).
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bebc9bad
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bebc9bad
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bebc9bad
Branch: refs/heads/3.3.x
Commit: bebc9bad78160367680a26e788e68d6830c13ef7
Parents: a782694
Author: John Plevyak <jp...@apache.org>
Authored: Sun Jun 2 15:46:11 2013 -0700
Committer: John Plevyak <jp...@acm.org>
Committed: Sun Jun 2 15:46:11 2013 -0700
----------------------------------------------------------------------
iocore/cache/CacheDir.cc | 4 ++--
iocore/cache/P_CacheDir.h | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bebc9bad/iocore/cache/CacheDir.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index ca23f9f..7e39b09 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -360,7 +360,7 @@ void
dir_clean_segment(int s, Vol *d)
{
Dir *seg = dir_segment(s, d);
- for (int i = 0; i < d->buckets; i++) {
+ for (int64_t i = 0; i < d->buckets; i++) {
dir_clean_bucket(dir_bucket(i, seg), s, d);
ink_assert(!dir_next(dir_bucket(i, seg)) || dir_offset(dir_bucket(i, seg)));
}
@@ -369,7 +369,7 @@ dir_clean_segment(int s, Vol *d)
void
dir_clean_vol(Vol *d)
{
- for (int i = 0; i < d->segments; i++)
+ for (int64_t i = 0; i < d->segments; i++)
dir_clean_segment(i, d);
CHECK_DIR(d);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bebc9bad/iocore/cache/P_CacheDir.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index a7e7e1a..e25c957 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -316,7 +316,7 @@ dir_compare_tag(Dir *e, CacheKey *key)
}
TS_INLINE Dir *
-dir_from_offset(int i, Dir *seg)
+dir_from_offset(int64_t i, Dir *seg)
{
#if DIR_DEPTH < 5
if (!i)
@@ -333,24 +333,24 @@ next_dir(Dir *d, Dir *seg)
int i = dir_next(d);
return dir_from_offset(i, seg);
}
-TS_INLINE int
+TS_INLINE int64_t
dir_to_offset(Dir *d, Dir *seg)
{
#if DIR_DEPTH < 5
return (((char*)d) - ((char*)seg))/SIZEOF_DIR;
#else
- int i = (int)((((char*)d) - ((char*)seg))/SIZEOF_DIR);
+ int64_t i = (int64_t)((((char*)d) - ((char*)seg))/SIZEOF_DIR);
i = i - (i / DIR_DEPTH);
return i;
#endif
}
TS_INLINE Dir *
-dir_bucket(int b, Dir *seg)
+dir_bucket(int64_t b, Dir *seg)
{
return dir_in_seg(seg, b * DIR_DEPTH);
}
TS_INLINE Dir *
-dir_bucket_row(Dir *b, int i)
+dir_bucket_row(Dir *b, int64_t i)
{
return dir_in_seg(b, i);
}