File Coverage

blib/lib/CPU/x86_64/InstructionWriter/Unknown.pm
Criterion Covered Total %
statement 13 20 65.0
branch 2 8 25.0
condition 0 3 0.0
subroutine 5 7 71.4
pod 3 4 75.0
total 23 42 54.7


line stmt bran cond sub pod time code
1             package CPU::x86_64::InstructionWriter::Unknown;
2             our $VERSION = '0.002'; # VERSION
3 17     17   115 use strict;
  17         36  
  17         488  
4 17     17   86 use warnings;
  17         37  
  17         559  
5 17     17   118 use Carp;
  17         39  
  17         5247  
6              
7             # ABSTRACT: Placeholder for a constant that will be assembled
8              
9              
10             sub new {
11 54815     54815 0 185717 my ($class, %fields)= @_;
12 54815         323919 bless \%fields, $class;
13             }
14              
15 0 0   0 1 0 sub name { $_[0]{name}= $_[1] if @_ > 1; $_[0]{name} }
  0         0  
16              
17             sub bits {
18 0     0 1 0 my $self= shift;
19 0 0       0 return $self->{bits} unless @_;
20 0         0 my $val= shift;
21 0 0 0     0 !defined $self->{bits} || $self->{bits} == $val
22             or croak "Can't change bits from $self->{bits} to $val for unknown($self->{name})";
23 0         0 $self->{bits}= $val;
24             }
25              
26 30 100   30 1 85 sub value { $_[0]{value}= $_[1] if @_ > 1; $_[0]{value} }
  30         65  
27              
28             1;
29              
30             __END__