Mostly Bollogs, I'm afraid

But occasionally, a glimmer of truth.
If you find one, please let me know.



Thursday 20 November 2014

Straight C

I have something that works.

It is GCC and on a 16bit machine, so int is 16 bits.

typedef unsigned int uint16;

#define NO_OF_BATTERIES 2
#define TIME_AVERAGE 5
uint16 aa_timeAverage[NO_OF_BATTERIES][TIME_AVERAGE]={1,2,3,4,5,6,7,8,9,0xa};

uint16* pNewTimeValue;

void main(void) {
    int iBattery=0;
    pNewTimeValue = aa_timeAverage[iBattery]);             // store pointer for new time average value
    memmove(aa_timeAverage[iBattery]+1,                       // destination: element 1
         aa_timeAverage[iBattery],                                         // source: element 0
        sizeof(uint16)*(TIME_AVERAGE-1));                     // shift up Time Values
    *pNewTimeValue=99;
}

If I change it to:

    memmove(aa_timeAverage[iBattery]+1,                      // destination: element 1
        &(aa_timeAverage[iBattery][0]),               // source: element 0
        sizeof(uint16)*(TIME_AVERAGE-1));                          // shift up Time Values

I need to cast as (const uint16 *)&(aa_timeAverage[iBattery[0]) to stop a compiler "suspicious pointer" warning.

Anyone know why?


Thursday 6 November 2014

Fool

The Government announced today that they are to write to the petrol-selling folk to tell them that the oil price has fallen by 20% and the pump price has only fallen by 5% and that this isn't good enough.

That's a fact.

80% of the price the consumer pays at the pump goes to the Treasury, in Fuel Duty (with VAT compounded on that duty).

That's a fact, too.

Take the price of petrol as £1.25.

80% of that is a quid.

The petrol you're paying for is 25p.

If that falls by 20%, it's now 20p. Add the quid that the Treasury takes, it's £1.20.

Now, 5% off the original £1.25 is 6¼p. So you should be paying £1.25 - 6¼p, which is £1.18¾p.

So you're paying 1¼p per litre too much for fuel, unless you go to TESCO, ASDA, Morrison's. And many others, in which case you're paying less. And you're getting more than 5% off. You can shop around, it's your choice. All petrol is much the same, and there aren't many refiners.

The petrol-selling folk sell a lot of petrol. And they employ a lot of people, who pay tax to the Treasury.

And the government is going to write to the petrol-selling folk to tell them to be fair.

I know who you need to write to.

So now who's a fuel fool?

Any rocket scientists, politicians, mathematicians out there want to argue?



Tuesday 4 November 2014

Recursion

I'm having trouble getting my head round this.

Monday 3 November 2014

Those few. Those happy few.

I am humbled by those who fought for our country.

I wasn't there when it was invaded by the Germans, not in the fighting kind of way. I am here now, being invaded by the Germans, whose economy is fucked beyond recognition. Who are now asking us for £1.7Bn to bale them out of the shit in which they've found themselves, because some pillocks thought that joining the EU was a brilliant plan.

Fuck them. Fuck the EU.

Those who fought, against their will, often, for that which we hold dear, who died because we had no choice but to fight the bastards, those good and true men, I hold in the utmost respect. The poor sods.

Those who now fight in silly skirmishes, against brown people with oil, where the MSM report daily if ONE of them has died, no, I don't do that. They would be better off, those happy few, telling the government to stuff their stupid pseudo-patriotic bollocks right up their arses so it brings to mind cancer of the tonsils, and by God I wish they'd have the balls to do so.

Just me. No offence to the proper geezer who did that for the right reasons. I just don't know many of them.

As always, just my opinion.