f

#### how to locate right slot in a range with right-shifting and offset?

```Hi all,

Assume I non-uniformally break down a range from 0 to (2^10)-1 into
(2^4)-1 blocks.

|----|---|------|---|......|--|
0    5   7                   (2^10)-1

For a given value x (x may be from 0 to 2^10-1), I would like to
locate what block x should be in. For example if x is 6, I want to
find the second block (from 5 to 7) in the above figure. ( x is
integers).

In a technical report, for this task, I see they use the operator:

(>> is right shift).
where shift_amount and offset_amount are the same for all values of x.
(all operation is implemented in binary).

Can you please explain how this way works? and how to determine
shift_amount and offset_amount?
Honestly, I do not understand how this algorithm works. Do you see any
thing like this for block location? (I mean using right shift and
offset)?

In your case when  you implement an interpolation in hardware, how do
you search for the boundary for a given input?

Thank you very much.
```
 0
aelover11 (81)
1/11/2009 11:56:04 PM
comp.programming 11491 articles. 2 followers.

1 Replies
543 Views

Similar Articles

[PageSpeed] 42

```"A.E lover" <aelover11@gmail.com> writes:

> Hi all,
>
> Assume I non-uniformally break down a range from 0 to (2^10)-1 into
> (2^4)-1 blocks.
>
> |----|---|------|---|......|--|
> 0    5   7                   (2^10)-1
>
> For a given value x (x may be from 0 to 2^10-1), I would like to
> locate what block x should be in. For example if x is 6, I want to
> find the second block (from 5 to 7) in the above figure. ( x is
> integers).
>
> In a technical report, for this task, I see they use the operator:
>
> block_address=x >> shift_amount + offset_amount.
>
> (>> is right shift).
> where shift_amount and offset_amount are the same for all values of x.
> (all operation is implemented in binary).
>
> Can you please explain how this way works? and how to determine
> shift_amount and offset_amount?
> Honestly, I do not understand how this algorithm works. Do you see any
> thing like this for block location? (I mean using right shift and
> offset)?

In this case, the break down is uniform.

(x >> n)  ==  (x / 2^n)

so all blocks will have the same size, 2^b.

If your blocks have random sizes (even if increasing), then the best you
can do is to keep the block boundaries sorted in apply a DICHOTOMY to
find out in which block your number lie.

On the other hand, if your block boundaries are generated with a
function easily inversible, for example,

boundary(block_number)     = 2^block_number

then you can easily find the block_number of a number by using the
inverse:

boundary(block_number(x)) <= x < boundary(block_number(x)+1)
<=> 2^block_number(x) <= x < 2^(block_number(x)+1)
<=> log2(2^block_number(x)) <= log2(x) <log2(2^(block_number(x)+1))
<=> block_number(x) <= log2(x) < block_number(x)+1)
<=> block_number(x) = floor(log2(x))

But as long as you use a function to generate the boundaries, I'd say
there's some level of "uniformity" in their repartition...

> In your case when  you implement an interpolation in hardware, how do
> you search for the boundary for a given input?

This qualification is meaningless.  It makes no difference whether it's
implemented in software, in hardware, in firmware, in wetware,
whatever.  Hardware contains much more software than you think.

--
__Pascal Bourguignon__
```
 0
pjb (7869)
1/12/2009 7:18:47 AM

Similar Artilces:

what does SHIFT-left-or-right of up-down-left-right do?
Well, I know about shift up-and-down: shift-right ("red" or whatever) up and down on choose-box, HIST, things like that, take the cursor all the way to the beginning or the end. shift-left ("white") on up and down scroll the screen-full up or down (the FIRST such click *stupidly* goes to the final CURRENTLY-ON-SCREEN choice or whatever (meaning TWO double-button-pushes to scroll-down that FIRST time.) What are some of the OTHER possibilities, ie with the left and right arrows? Oh, apparantely undocumented, I've found (via mistaken key-pushes) that RIGHT-arrow will do a SWAP (on stack), and that an UP-arrow gets you into HIST (that HIST is *one nice feature*!) Other tricks with those arrows? Thanks! David David Combs wrote: > Well, I know about shift up-and-down: > > shift-right ("red" or whatever) up and down on > choose-box, HIST, things like that, take the > cursor all the way to the beginning or the end. > > shift-left ("white") on up and down scroll the > screen-full up or down (the FIRST such click > *stupidly* goes to the final CURRENTLY-ON-SCREEN > choice or whatever (meaning TWO double-button-pushes > to scroll-down that FIRST time.) > > > What are some of the OTHER possibilities, ie with the > left and right arrows? > > > Oh, apparantely undocumented,...

Microsoft and rights management. right...

Right time at the right place.

Is this program right?

Is this program right?
Hey, is this program right? It calculates the average, harmonic mean, quadratic mean, and the standard deviation for two numbers. Can you proofread it for me? Here it is: #include <iostream> #include <cstdlib> #include <cmath> using namespace std; template <class T> class avg { public: T operator()(const T& num, const T& num2)const { T ret=((num+num2)/2); return ret; } T operator()(const T& num, const T& num2, int x)const { T ret=(sqrt(pow(num,2)+pow(num,2))); return ret; } T operator()(const T& num, const T& num2,int x,int y)const { ...

Right Shift
Here's some confusion for you... <?PHP \$x = (4653896912 >> 13); echo \$x; ?> I ran that on two different servers. Server A gave me: 43814 Server B gave me: 568102 I have been hacking away and researching this for hours. I am completely clueless. Any suggestions or workarounds? Thanks in advance. I just figured out that server A is a 32 bit machine and server B is 64. How can I account for this? CrashRoX said the following on 15/03/2006 10:32: > Here's some confusion for you... > > <?PHP > \$x = (4653896912 >> 13); > echo \$x; > ?> > > I ran that on two different servers. > > Server A gave me: 43814 > Server B gave me: 568102 > > I have been hacking away and researching this for hours. I am > completely clueless. Any suggestions or workarounds? Thanks in advance. > 4653896912 is bigger than can be represented as a signed-int on a 32-bit platform, so gets truncated to 358929616. And (358929616 >> 13) == 43814. However, 4653896912 can be represented as a signed-int on a 64-bit platform, giving the "correct" answer of 568102. [NOTE: I haven't checked this to see if it's right though...] -- Oli Im actually looking for the answer as 43814. Is there no "workaround" or solution to force a 64 bit machine to generate the same answer? CrashRoX said the following on 15/03/2006 10:48: > Im actually looking for the answer as 43814. Is there no "work...

block the right port on the right ip
hi,i know in some countries, several people share the same ip but different ports, so i think "block ip only" is not appropriate. may we should just block the right port at the right ip.does anybody there agree with me? samplestrategy@gmail.com dixit: > hi,i know in some countries, several people share the same ip but > different ports, In order to share the same physical IP address, you gotta have a router that supports NAT or some other protocol that will translate between public (physical) and virtual (private) IP addresses. So, the rule is, a host...

Z1300 Update: InkStop Does Right, but Are They Right?
Well, I hauled the nonfunctioning Lexmark 34/35 "compatibles" back to InkStop this afternoon. Guess Kid Behind the Counter from Saturday must be back in school. His BIg Sister, who sold me the original pair, was back. Only today she was accompanied by Gramps, who I guess runs the place. Both of them repeated Kid's suggestion that I trade in their cartridges for a pair of OEMs, but to their credit and their company's, they didn't hesitate to refund my money when I told them I'd already bought OEMs elsewhere. Anyway, Gramps says they get around 4 per cent ...

setuid right without execution rights
Hello, I saw that you can give setuid rights to a file without execution right. What's the point of this ? In article <422d7f6d\$0\$17144\$636a15ce@news.free.fr>, Jeremy <sargon@no-log.org.spamno> wrote: > Hello, > I saw that you can give setuid rights to a file without execution right. > What's the point of this ? What OS are we talking about? The way you talk about this leads me to believe you may not come from a UNIX background. On MacOS X, the chmod man page says (the set-user-ID-on-execution bit) Executable files with this bit set will run w...

The right criticisms for the right OS (and/or its users)
I'm sure everyone will agree that Windows 7 flat-out rocks. No? Well, get a life, then. But yeah, Vista was the Windows Me of NT- based OSes, and now they're quickly putting XP out to pasture, when it's still the most widely used OS, and those are fair criticisms of Microsoft. (Then again, in Vista's case, they would have at some point had to release it - and it never would've gotten good enough until after it was released. That's unfortunately part of the game they were playing, but it was worth it to get past the initial rewrite, and achieve Win7. The NT/2000/XP codebase was indeed too burdened to build on, not that that implies anything about XP or its predecessors, which were part of the gradual transition into modern computing.) But to all the Unix geekwads (and no, that *isn't* a criticism of the software *itself*) who want to attack MS over their OEM licensing (among other ass-pulled-from stuff), just realize that you're wrong. Why are nearly all competitively priced computers only sold with Windows? Well, do you know *anything* about business, or do you just assume that it must be Microsoft's alleged bullying? The OEMs benefit from that licensing. It's called volume. They get discounted, widely usable software, they churn out hundreds of identical machines, people get a bargain - no doubt *cheaper* than offering options would be, for the same hardware. If you don't want the software, it's called formatting. W...

Shifting data to the right
Access97 using VBA code. I have an array of textboxes, 8 columns across and 5 rows down. If all the boxes in row 3 have data in them and I place my cursor in the 4th box in this row, how can I move the contents of 4 to 5 then 5 to 6, 6 to 7, and 7 to 8. I don't want to effect rows above and below row 3. All I want to do is push data to the right making room to insert an item to a lineup. My textboxes are named txt01 thru txt40 Each row represents a different machine lineup. I've looked at select case using Case txt17 to txt24 then breaking it into if txt17 if txt18 etc. This looks bulky and I hoped there might be a simpler solution via a function. Any suggestions. RICK This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C378A7.A810CA10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Rick-- With the naming system for the text boxes that you descibe, it sounds = like there's no array or matrix of boxes, just a lot of single boxes. = You could take advantage of one of the ways to name a control, namely = the =20 Me("txt" & format(n,"00")) =20 form, where n is the number of the box you want. Using the setup you = describe, you could use something like: Sub MoveStuffRight(RowNum as Integer, ColNum as Integer) ' 'This just moves things right by one position. Any contents in the last = cell are lost. 'RowNum is the row you want to work in, and ColNum...

Rights
I have a basic question regarding rights. What level of rights do I have to have to grant another user update rights? I don't want to give everyone owner rights. Can a person with update rights grant another person update rights? Thanks. "Chris_M" <cmcclendon@houston.rr.com> wrote in message news:d6cef4db.0311260956.5893b978@posting.google.com... > I have a basic question regarding rights. What level of rights do I > have to have to grant another user update rights? I don't want to > give everyone owner rights. Can a person with update rights grant > another person update rights? > > Thanks. You can grant a user update rights per table (and per column) if necessary. If you specify WITH GRANT OPTION, then that user can grant the update right to other users. There are examples in Books Online in the syntax for GRANT. A general best practice is to manage permissions with roles, not by individual user, as it makes things a lot easier. Also have a look at the built-in roles, such as db_datareader and db_datawriter, which can be useful. In general, though, it's considered better to allow data access only through stored procedures, if this is possible in your situation. This means that users never require update permissions on tables, they only have execute permissions on the procedures. That gives you more flexibility, as you can add logic to the procedure for more control. Check out "Using Ownership Chains" in Boo...

Is this right?
Am I right in making these assumptions? When an application is linked to the shared C library it calls XSharedCLibrary_LibInitAPCS_32, and this fills in the stubs (that initially look like lots of MOV PC,#0 instructions) with branches to entry points of code inside the CLib module. Branches must be to addresses within + or - 8Mb, there being only 24 bitsworth of offset in the branch instruction. Ergo, the CLib module must be stored within 8Mb of the area in which applications run. -- Gavin Wraith (gavin@wra1th.plus.com) Home page: http://www.wra1th.plus.com/ On Fri, 06 Oct 2006 13:41:22 +0100, Gavin Wraith wrote: > Am I right in making these assumptions? > > When an application is linked to the shared C library it > calls XSharedCLibrary_LibInitAPCS_32, and this fills > in the stubs (that initially look like lots of MOV PC,#0 > instructions) with branches to entry points of code > inside the CLib module. > > Branches must be to addresses within + or - 8Mb, there > being only 24 bitsworth of offset in the branch instruction. > > Ergo, the CLib module must be stored within 8Mb of the area > in which applications run. Hmm. Interesting question. I always seem to recall them being branches, but it can't be that simple for precisely the reasons you describe. Are you sure they're branches, rather than say, a load of LDR PC, someaddress, where someaddress is near the trampoline and is also filled in by the Shared C Library?...

Right on
December 11, 2007, 9:40 am Comic relief: The Apple Product Cycle As Macworld approaches, this is as good a time as any to revisit the canonical Apple Product Cycle, boiled down to 36 steps by an anonymous humorist who called himself misterbg. Originally posted more than three years ago, it rings as a true today as it did then. The full parody is available here. A sample below: It begins: An obscure component manufacturer somewhere in the Pacific Rim announces a major order for some bleeding-edge piece of technology that could conceivably become part of an expensive, digital-lifestyle-enhancing nerd toy. Soon: Eager Mac-heads fan the flames by flooding the Mac discussion forums with more groundless conjecture. Threads pop up around feature wish lists, favorite colors, and likely retail price points. Months later: As Macworld or the Worldwide Developer's Conference draws near, the chatter builds to a fever pitch. Rumor sites jockey for position, posting a new unverifiable, contradictory rumor every hour or so. eBay is flooded with six-month-old, slightly used gadgets as college students, underemployed web designers and independent musicians struggle to clear credit card space. Macworld arrives: Steve Jobs spends the first half-hour of his keynote crowing about how many iPods shipped during the previous six months and how many "native applications" have been developed for OS X. Attempting to appear as though it's just an aftertho...

Is it right?
hi I'm a beginner in matlab and I have to plot these FS but I'm not sure of my codes so could anyone help me!!! sawtooth signal x(t)=(2A/�)(sin(wt)-(1/2)sin(2wt)+(1/3)sin(3wt)- ...) my code is: T=.01 t=0:.000001:.03 x=0 for i=1:21 x=x+((sin(2*pi*(t/T)))/i) end plot(x) fully-rectified consinusoid x(t)=(2A/�)(1+(2/3)cos(wt)-(2/15)cos(2wt)+(2/35)cos(3wt)...) I don't know how to write it's code ??help me plz ...

free ipods and xbox are RIGHT HERE, RIGHT NOW !!!
www.customsoftwarezone.com/free Here it is.. The same guys that brought you the free iPods are now giving away free XBox 360s !!! Click my link for 3 FREE items: xbox 360, 60GB photo iPod, and 1GB iPod Shuffle.. www.customsoftwarezone.com/free It's a GREAT deal. Doesn't cost a dime... xbox x box x-box 360 xbox360 x-box360 x box360 iPod IPOD I Pod I-Pod i-pod shuffle photo 60 60G 60GB 1 1G 1GB xbox x box x-box 360 xbox360 x-box360 x box360 iPod IPOD I Pod I-Pod i-pod shuffle photo 60 60G 60GB 1 1G 1GB xbox x box x-box 360 xbox360 x-box360 x box360 iPod IPOD I Pod I-Pod i-pod ...

is this right?
hello! I'm trying to add many images, in the same figure then I try to get the standard deviation & contast.... I began with this: To read in the raw image data, For example, a 640x480 set of 10 images: % f=fopen('filename','rb'); % I=reshape(fread(fp,640*480*10,'uchar'),[640 480 10]); % fclose(f); Now I compute the contrast for a 7x7 region for all 10 files Nf=10; SC=zeros(size(I)); for i=1:Nf, SC(:,:,i)=colfilt(I(:,:,i),[7 7],'sliding',contrast); end Now I get the average the 10 files together SCm=mean(SC,3); why it does nor work, and how I ...

It is right?
*** Problem: [knuth's book 1 page 19 exercise 5][21] A prime number is an integer > 1 th= at has no divisor other than 1 and itself. Using this definition and mathem= atical induction, prove that every integer > 1 may be written as a product = of one or more prime number. (Aprime number is considered to be the "produ= ct" of a single prime, namely itself.) *** what I discover: Let two number n as n =3D P(ai) as product of i prime number ai n+1 =3D P(aj) where we want prove that aj are prime=20 n =3D n +1 -1 P(ai) =3D P(aj) -1 P(aj) - P(ai) =3D 1 (P(aj) / P(ai)) -1 =3D (1 / P(ai)) (P(ak)* ((P(aj-ak)) / (P(ai-ak)))) =3D (1 / P(ai)) where P(ak) are the k prime number that are=20 either in P(ai) and P(aj). And P(aj-ak) is the prime number in P(aj) without P(ak). The same is for P(ai-ak). (((P(aj-ak)) / (P(ai-ak))) - (1/(P(ak)))) =3D (1/((P(ai)* P(ak)))) (P(aj-ak) / P(ai-ak)) =3D ((P(ai) +1) / (P(ai)*P(ak))) (P(aj-ak)) =3D (((P(ai +1))*(P(ai-ak)))/(P(ai)*P(ak))) (P(aj-ak) / (P(ai)+1)) =3D ((P(ai-ak)) / ((P(ak)*P(ai))))=20 (P(aj-ak)/ P(ai-ak)) =3D ((P(ai)+1) / ((P(ak)*P(ai)))) P(aj-ak) =3D ((((P(ai) +1))*(P(ai-ak))) / (P(ak)*P(ai))) P(aj-ak) =3D P(aj-ak)* ((P(ai-ak)) / (P(ai))) P(ai-ak) / P(ai) =3D 1 what I discover is: bewteen n e n+1 there isn't prime number in common *** Conclusion It is correct? I don't solve the knuth's problem but the solution of my ste= m is correct? Thanks in ...

Index should be out of range, right?
2008 is ending in confusion for me. Here is an example of why: IDL> x=intarr(10,10) IDL> y=indgen(15) IDL> x[y,y]=1 IDL> print, x 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ...

I was right again!!!
I predicted after the launch of Windows 8 that the operating system would flop in a tremendous way and that it would lead to the ouster of both Sinofsky and Ballmer. Sinofsky left shortly after the release of Windows 8. Ballmer just today announced his departure. That makes my predictions 3 out of 3!! Next year I predict we will see a sizable number of Windows XP users defect to Linux as M\$ stops supporting the OS. Some people have suggested that M\$ will keep supporting XP just to prevent Linux from establishing a beachhead on the desktop. I however, predict that they will make the (wrong) gamble that XP users will buy a new computer with Windows 8.2 (yes, I'm predicting a further point upgrade of Windows 8 too). After 30% of desktop users have switched to Linux the company will be in a death throe, quickly spiraling out of control. I'm gonna enjoy watching the demise of MicroShaft!! ...

right-on
Imagine how useless comp.arch.embedded would be if everybody looking for a job posted articles such as yours. Please refrain from again doing so. Michael ======================================================= Michael Kesti | "And like, one and one don't make | two, one and one make one." mrkesti at comcast dot net | - The Who, Bargain Imagine how useless Democracy would be if it were run like usenet news - I've come to expect this crapshit from you fucking americans. ...

shift right arithmetic
is there an equivalent way in verilog to do this: The contents of the low-order 32-bit word of a number are shifted right, duplicating the sign-bit (bit 31) in the emptied bits It's so easy that I'm not sure I understand your meaning right. @clk reg A[31:0]= {A[31],A[31:1]} "rekz" <aditya15417@gmail.com> ??????:ade3aa13-3209-4ba6-b534-87c624d542e8@x22g2000yqx.googlegroups.com... > is there an equivalent way in verilog to do this: > > The contents of the low-order 32-bit word of a number are shifted > right, duplicating the sign-bit (bit 31) in the emptied > bits rekz wrote: > is there an equivalent way in verilog to do this: > > The contents of the low-order 32-bit word of a number are shifted > right, duplicating the sign-bit (bit 31) in the emptied > bits Are you looking for the >>> operator? In reality there are many ways to do this. The >>> operator only works if the value is signed. For unsigned values you need to either cast it signed or resort to bit manipulation like the previous poster showed. Cary On Sun, 07 Mar 2010 23:54:35 -0800, "Cary R." wrote: >The >>> operator only works if the value is signed. WHOAH! How many times have I ranted about this...? Let's try again. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The >>> operator gives sign-extended shift only if it is used in a signed EXPRESSION....

Is this right?
I have heard some thing from my lecture that I disagree. and I would like to hear if I am wrong. "A variable is an object" "C hasn't changed in the past 30 years" "C is an extended assembly language" "Procedure generate unreadable code" I know that C may be considered low level, but I am not sure about extended assembly language. I don't even consider HLA an extended assembly language. But I may be wrong please give your opinion Thanks Profetas "Profetas" <xuxu_18@yahoo.com> wrote in message news:e3a3c840b05a99a337313fc11601...

does PHP read left to right or right to left?
I've two functions. currentHeadline looks in \$_GET for a variable called 'image' and prints what it finds. showThumbnail takes an image for a parameter and resizes it before sending it to the screen. But when I do this: <?php showThumbnail(currentImage(), 20, 20); ?> showThumbnail is telling me that it is not being given a file name, and currentImage is printing the file name to the screen. How is that possible? What is the right way to do this? lawrence k wrote: > I've two functions. currentHeadline looks in \$_GET for a variable > called 'image' and prints what it finds. showThumbnail takes an image > for a parameter and resizes it before sending it to the screen. But > when I do this: > > <?php showThumbnail(currentImage(), 20, 20); ?> > > showThumbnail is telling me that it is not being given a file name, and > currentImage is printing the file name to the screen. How is that > possible? What is the right way to do this? Nevermind, I'm an idiot. currentImage was echoing its result to the screen instead of returning it. lawrence k wrote: > I've two functions. currentHeadline looks in \$_GET for a variable > called 'image' and prints what it finds. showThumbnail takes an image > for a parameter and resizes it before sending it to the screen. But > when I do this: > > <?php showThumbnail(currentImage(), 20, 20); ?> currentImage() will execute before showThumbnai...

Web resources about - how to locate right slot in a range with right-shifting and offset? - comp.programming

Book News: Books for Relief, Shifting Rights
J. M. Coetzee, Toni Morrison, Junot Díaz, and several other writers and activists have signed a petition to make books a part of post-disaster ...

Mormon Church Shifting Its Views On Homosexuality, Say Gay Rights Activists
... of Latter-day Saints "is subtly but unmistakably growing friendlier toward" the LGBT community, "including voicing support for some gay rights." ...

A shifting landscape: Gay rights, RFRA and the GOP
Gov. Mike Pence stood pat against gay rights, as nation changed. Now some Republicans try to assess the what's mainstream

Gay rights group changing its name, shifting focus after recent victories
National Gay and Lesbian Task Force will shift focus more to legal and societal issues that have arisen in wake of recent same-sex marriage rulings. ...

States' Rights And DOMA Clash On A Shifting Battlefield : The Two-Way : NPR
The debate over states' rights versus federal power is as old as our country, but this time the subject of controversy is relatively new. As ...

Animal Rights In China Get Boost From Celebrity Activists And Shifting Attitudes
... in 1998, said she's seen interest in animal rights snowball in China over the last few years, spurred by support from celebrities and shifting ...

States' Rights And DOMA Clash On A Shifting Battlefield
The debate over states' rights versus federal power is as old as our country, but this time the subject of controversy is relatively new. As ...

Resources last updated: 3/26/2016 4:52:01 PM