Skip to content

Instantly share code, notes, and snippets.

@manicai
Created April 22, 2011 18:15
Show Gist options
  • Save manicai/937285 to your computer and use it in GitHub Desktop.
Save manicai/937285 to your computer and use it in GitHub Desktop.
Simple AutoExp visualizers
class TimePeriod
{
private:
unsigned int value_;
public:
TimePeriod(int days, int months, int years)
{
value_ = days;
value_ += months << 16;
value_ += years << 20;
}
int days() const { return (value_ & 0xFFFF); }
int months() const { return (value_ & 0xF0000) >> 16; }
int years() const { return value_ >> 20; }
};
TimePeriod{
preview (
#(
(($c.value_ & 0xFFF00000) >> 20), " years ",
(($c.value_ & 0xF0000) >> 16), " months ",
($c.value_ & 0xFFFF), " days"
)
)
children
(
#(
[raw] : [$c,!],
years : (($c.value_ & 0xFFF00000) >> 20),
months : (($c.value_ & 0xF0000) >> 16),
days : ($c.value_ & 0xFFFF)
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment