Skip to content

Commit

Permalink
Rename private std.typecons._aligned to _alignUp and add constraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-sh committed Nov 18, 2012
1 parent 525fb51 commit 603d2e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions std/typecons.d
Expand Up @@ -3076,7 +3076,7 @@ unittest
// _d_newclass now use default GC alignment (looks like (void*).sizeof * 2 for
// small objects). We will just use the maximum of filed alignments.
alias classInstanceAlignment!T alignment;
alias _aligned!alignment aligned;
alias _alignUp!alignment aligned;

static struct Scoped(T)
{
Expand Down Expand Up @@ -3107,7 +3107,8 @@ unittest
return result;
}

private size_t _aligned(size_t alignment)(size_t n)
private size_t _alignUp(size_t alignment)(size_t n)
if(alignment > 0 && !((alignment - 1) & alignment))
{
enum badEnd = alignment - 1; // 0b11, 0b111, ...
return (n + badEnd) & ~badEnd;
Expand Down

0 comments on commit 603d2e2

Please sign in to comment.