eh? When you are programming the output port you are writing a bit-pattern to it (8 bits = 1 word, usually a hex value but could be straight binary or even decimal depending on the method you decided to use when programming).

The logical OR function is part of the programming language and is - I suppose - the 'math' you are referring to.