Brightening up bitmap data with code only?

I’ve got a “spotlight” image and a seperate image I want to light up using the spotlight image. I’ve included the images as attachments. I’ve also included a photoshopped version of the result I’m looking for. I tried the following (that I thought would work)

a = spotlight.getPixel(x1,y1);
b = original.getPixel(x1,y1);

c = a * b;

mainBitmapBD.setPixel(x1,y1,c);

Instead of

c = a *b

I’ve tried OR-ing the colors

c = a | b;

I’ve tried to split the channels up, multiply and then combine them again

r1 = a >>16;
g1 = a >>8 & 0xFF;
b1 = a & 0xFFFF;

r2 = b >>16;
g2 = b >>8 & 0xFF;
b2 = b & 0xFFFF;

c = (r1 * r2)<<16 | (g1 * g2)<<8 | (b1 * b2) ;

and OR-ing them

c = (r1 | r2)<<16 | (g1 | g2)<<8 | (b1 | b2) ;

I realise these two things are the same but for some reason they give out different results sometimes…Nothing works and it’s driving me crazy, anyone that can help? I’ve included a b/w image, but I want this to work for color images as well.