Program Listing for File count_op_instructions.hpp¶
↰ Return to documentation for file (include/sgpl/introspection/count_op_instructions.hpp)
#pragma once
#ifndef SGPL_INTROSPECTION_COUNT_OP_INSTRUCTIONS_HPP_INCLUDE
#define SGPL_INTROSPECTION_COUNT_OP_INSTRUCTIONS_HPP_INCLUDE
#include <cassert>
#include "../program/Program.hpp"
#include "count_instructions.hpp"
namespace sgpl {
template<typename Spec>
size_t count_op_instructions( const sgpl::Program<Spec>& program ) {
assert(
sgpl::count_instructions<Spec>( program, "op" )
== program.size() - sgpl::count_instructions<Spec>( program, "nop" )
);
return sgpl::count_instructions<Spec>( program, "op" );
}
} // namespace sgpl
#endif // #ifndef SGPL_INTROSPECTION_COUNT_OP_INSTRUCTIONS_HPP_INCLUDE