I've been stuck with a particularly tricksy problem. The developer that previously worked on the project I am busy with developed a news module with articles and categories. Each news article can be assigned to one or more news categories.
However, the manner in which these news categories have been referenced is perplexing. The system uses bitwise operations to calculate "new" category IDs (For example, news article with category ID 256 actually belongs to category with ID 8).
The real problem comes in when a news article belongs to multiple categories. The shifted values of the two (or more) genres to which the news article belongs are added together, and then stored as a single integer value in the database. My problem comes in when I'm needing to break this single integer value apart into the constituent category IDs, so that I can query the names of the categories to which it belongs.
If anybody could offer some help, or provide some sort of starting help, I'd seriously appreciate it. My brain is feeling absolutely frazzled - I've been having to deal with logs, which I haven't done since high school! :)