Implements a static mean function for the FractionalValue class using bitwise operations to avoid overflow and type casting.
Scanned 5/30/2026
Install via CLI
openskills install gabrielmoreira/agent-skills-mirror---
id: "a85fb3e3-5bef-49c2-988d-bced993347ff"
name: "Bitwise Mean Implementation for FractionalValue Class"
description: "Implements a static mean function for the FractionalValue class using bitwise operations to avoid overflow and type casting."
version: "0.1.0"
tags:
- "C++"
- "bitwise operations"
- "optimization"
- "fixed-point arithmetic"
- "static methods"
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
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
1. The function must be a static member function of the class.
2. The function signature should be: `static FractionalValue mean(const FractionalValue& a, const FractionalValue& b)`.
3. Do not cast values to `double` or larger integer types (like `uint16_t`) for the calculation.
4. Use bitwise operations to calculate the mean to avoid overflow.
5. The specific bitwise formula to use is: `(a() >> 1) + (b() >> 1) + (((a() & 1) + (b() & 1)) >> 1)`.
6. 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
No comments yet. Be the first to comment!
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...
**Complete production-ready guide for Google Gemini embeddings API** This skill provides comprehensive coverage of the `gemini-embedding-001` model for generating text embeddings, including SDK usage, REST API patterns, batch processing, RAG integration with Cloudflare Vectorize, and advanced use cases like semantic search and document clustering. ---
Interview, source-challenge, verify, save, and ADR-gate fuzzy coding requests into Codex-ready implementation specs. Use when a feature, bugfix, refactor, migration, repo-wide change, or architecture task needs user-verified requirements, source-backed decisions, durable architecture decisions, acceptance criteria, validation commands, rollout notes, saved spec/ADR files, and a Codex execution prompt. Do not use when already fully specified or when the user wants direct implementation now.
Use when a repo needs CodeGraph plus ast-grep for Codex MCP setup, exploration, impact analysis, structural search, or safe refactor planning.