> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/bcd_8h_source.md).

# bcd.h

[Go to the documentation of this file.](/s-adk-5.1-programmers-guide/readme/files/dir_20ccae320a59b06ef6618c5b737d5c02/dir_5e53e51918e971c6ecb7778a0c977255/dir_e180e45849113f6ee3b1d48173f5e474/bcd_8h.md)

```cpp
 1 // -*- Mode: C++ -*-
 2 #ifndef BCD_H_20200406
 3 #define BCD_H_20200406
 4 
 7 #include <stdint.h>
 8 #include <string.h>
 9 
 10 #if defined _WIN32 && defined VFI_SDICLIENT_EXPORT
 11 # define DllSpec __declspec(dllexport)
 12 #elif defined __GNUC__ && defined VFI_SDICLIENT_EXPORT
 13 # define DllSpec __attribute__((visibility ("default")))
 14 #else
 15 # define DllSpec
 16 #endif
 17 
 18 namespace vfisdi {
 19 
 20 DllSpec bool bcdset(unsigned char *buffer, unsigned size, int64_t value);
 21 DllSpec int64_t bcdget(const unsigned char *buffer, unsigned size);
 22 
 24 template<int N> class BCD {
 25  public:
 27  unsigned char v[N];
 28 
 30  BCD() { memset(v,0,N); }
 32  BCD(const unsigned char val[N]) { set(val); }
 34  BCD(int64_t val) { set(val); }
 36  BCD(int val) { set(val); } // without this e.g. BCD<2>(0) would be ambiguous: int64_t vs. unsigned char *
 37 
 39  void set(const unsigned char val[N]) { memcpy(v,val,N); }
 41  bool set(int64_t val) { return bcdset(v,N,val); }
 42 
 44  int64_t get() const { return bcdget(v,N); }
 45 
 47  unsigned size() const { return N; }
 48 };
 49 
 50 } // namespace vfisdi
 51 
 52 #undef DllSpec
 53 
 54 #endif
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/bcd_8h_source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
