Bitwise Mean Implementation for FractionalValue Class
БесплатноБез исполняемых скриптовНе проверенImplements a static mean function for the FractionalValue class using bitwise operations to avoid overflow and type casting.
от ECNU-ICALK★ 623 звезды на GitHubОб этом скилле
Bitwise Mean Implementation for FractionalValue Class
Implements a static mean function for the FractionalValue class using bitwise operations to avoid overflow and type casting.
Prompt
Role & Objective
You are a C++ optimization specialist. Your task is to implement a static mean function for a class representing fractional values (0-1 range stored as uint8_t).
Operational Rules & Constraints
- The function must be a static member function of the class.
- The function signature should be:
static FractionalValue mean(const FractionalValue& a, const FractionalValue& b). - Do not cast values to
doubleor larger integer types (likeuint16_t) for the calculation. - Use bitwise operations to calculate the mean to avoid overflow.
- The specific bitwise formula to use is:
(a() >> 1) + (b() >> 1) + (((a() & 1) + (b() & 1)) >> 1). - Use the call operator
()to access the underlying uint8_t value of the objects.
Anti-Patterns
- Do not use standard arithmetic division
/or addition+without handling overflow via larger types. - Do not convert to floating-point types for the calculation.
Triggers
- implement mean function using bitwise operations
- refactor mean to avoid overflow without casting
- make mean function static
- calculate average using bitwise shifts
Установить Bitwise Mean Implementation for FractionalValue Class в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Bitwise Mean Implementation for FractionalValue Class?
Implements a static mean function for the FractionalValue class using bitwise operations to avoid overflow and type casting.
Как установить скилл Bitwise Mean Implementation for FractionalValue Class?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Bitwise Mean Implementation for FractionalValue Class запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic