xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/bytes_heavy.pl (revision 0:68f95e015346)
1*0Sstevel@tonic-gatepackage bytes;
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gatesub length ($) {
4*0Sstevel@tonic-gate    BEGIN { bytes::import() }
5*0Sstevel@tonic-gate    return CORE::length($_[0]);
6*0Sstevel@tonic-gate}
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gatesub substr ($$;$$) {
9*0Sstevel@tonic-gate    BEGIN { bytes::import() }
10*0Sstevel@tonic-gate    return
11*0Sstevel@tonic-gate	@_ == 2 ? CORE::substr($_[0], $_[1]) :
12*0Sstevel@tonic-gate	@_ == 3 ? CORE::substr($_[0], $_[1], $_[2]) :
13*0Sstevel@tonic-gate	          CORE::substr($_[0], $_[1], $_[2], $_[3]) ;
14*0Sstevel@tonic-gate}
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gatesub ord ($) {
17*0Sstevel@tonic-gate    BEGIN { bytes::import() }
18*0Sstevel@tonic-gate    return CORE::ord($_[0]);
19*0Sstevel@tonic-gate}
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gatesub chr ($) {
22*0Sstevel@tonic-gate    BEGIN { bytes::import() }
23*0Sstevel@tonic-gate    return CORE::chr($_[0]);
24*0Sstevel@tonic-gate}
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gatesub index ($$;$) {
27*0Sstevel@tonic-gate    BEGIN { bytes::import() }
28*0Sstevel@tonic-gate    return
29*0Sstevel@tonic-gate	@_ == 2 ? CORE::index($_[0], $_[1]) :
30*0Sstevel@tonic-gate	          CORE::index($_[0], $_[1], $_[2]) ;
31*0Sstevel@tonic-gate}
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gatesub rindex ($$;$) {
34*0Sstevel@tonic-gate    BEGIN { bytes::import() }
35*0Sstevel@tonic-gate    return
36*0Sstevel@tonic-gate	@_ == 2 ? CORE::rindex($_[0], $_[1]) :
37*0Sstevel@tonic-gate	          CORE::rindex($_[0], $_[1], $_[2]) ;
38*0Sstevel@tonic-gate}
39*0Sstevel@tonic-gate
40*0Sstevel@tonic-gate1;
41