Skip to content

Commit

Permalink
git-svn-id: svn+ssh://szmaragd.im.pwr.wroc.pl/svn/RBO-new/JAVA@16975 …
Browse files Browse the repository at this point in the history
…1115ff72-a50f-0410-a26c-deacd0c0f9ad
  • Loading branch information
kik committed Nov 29, 2012
1 parent e16697e commit 2c7cc5e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Rbo.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,39 @@ public static int nextSlotIn(int k, int t, int r1, int r2)
public static int totalNSI=0;


// decompositions

public static int l(int k, int s, int i)
{
int l1=0;
int s1=1;
while((s&s1)==0 && l1<k){
s1=s1<<1;
l1++;
}
if(i==0) return l1;
else return l(k, s+s1, i-1);
}

public static int minY(int k, int s, int i)
{
if(i==0) return s;
// else
s=s+(1<<l(k,s,0));
return minY(k, s, i-1);
}


/// main for tests

public static void main(String[] args)
{
// test decompositions
int k=5;
int s=12;
for(int i=0; i<5; i++){
System.out.println("minY("+k+","+s+","+i+")="+Rbo.minY(k,s,i) );
System.out.println("l("+k+","+s+","+i+")="+Rbo.l(k,s,i) );
}
}
}

0 comments on commit 2c7cc5e

Please sign in to comment.