Roughly speaking, the legal limit in the UK equates to about half a unit of alcohol in your system, probably a little less actually. So that gives you an extra margin for error of no more than a quarter-pint of typical beer, assuming you wanted to drink for eight hours and still be inside the limit, and during those eight hours you drank the exact amount of alcohol your body can metabolise in that time.
The calculation can't be any more precise than this because rate of metabolism varies from person to person. Roughly, though, you can expect to be able to drink 4 pints in eight hours and still be inside the limit at the end of it. However that may turn out to be too much for your body to cope with safely, and even then it could depend how quickly you drank it. Basically, you should probably drink each pint evenly over a couple of hours, taking a sip every few minutes and pacing it perfectly.
But, honestly, where's the fun in that? You should be drinking to enjoy the drink!
I hope very much that this is a hypothetical question.