| 1962 | } |
| 1963 | |
| 1964 | LiteralProto LiteralBase::ToProto() const { |
| 1965 | LiteralProto proto; |
| 1966 | root_piece().ForEachSubpiece( |
| 1967 | [&](const ShapeIndex& index, const Piece& piece) { |
| 1968 | LiteralProto* proto_piece = &proto; |
| 1969 | for (int64 i : index) { |
| 1970 | while (proto_piece->tuple_literals_size() <= i) { |
| 1971 | proto_piece->add_tuple_literals(); |
| 1972 | } |
| 1973 | proto_piece = proto_piece->mutable_tuple_literals(i); |
| 1974 | } |
| 1975 | piece.WriteToProto(proto_piece); |
| 1976 | }); |
| 1977 | |
| 1978 | return proto; |
| 1979 | } |
| 1980 | |
| 1981 | const void* LiteralBase::untyped_data(const ShapeIndex& shape_index) const { |
| 1982 | return piece(shape_index).untyped_data(); |
no test coverage detected