multiplying by 321 without using * or / operators
I'm trying to write a program that multiplies any given number by 321 without using the built in multiplication or division operators (cannot do x * 321 or x / (1/321) ). I think I am going to have to use the bitwise operators, and then combine some sort of a mask using some bitwise operator. If anyone has done this before I'd really appreciate some help. I tried finding a pattern in the sequence of bits as it relates x (the number I'm multiplying) and x multiplied by 321. I could not find any static mask that I can use in all situations. I think I am going to have to calculate the mask, i.e I'm going to have to use some sort of an equation to create a mask and then use the mask to multiply x by 321? This is pretty confusing stuff :( Does it seem like I'm remotely on the right track? I feel lost.